Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
From my medium post on Keycloak auth in GraphQL
const resolvers = {
Subscription: {
commentAdded: {
subscribe: () => pubsub.asyncIterator(COMMENT_ADDED)
},
messageAdded: {
subscribe: auth(() => pubsub.asyncIterator(COMMENT_ADDED))
},
alertAdded: {
subscribe: hasRole('admin')(() => pubsub.asyncIterator(ALERT_ADDED))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment