Skip to content

Instantly share code, notes, and snippets.

@PatrikValkovic
Created March 21, 2023 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrikValkovic/dd93060608e0925a384cb1be321de874 to your computer and use it in GitHub Desktop.
Save PatrikValkovic/dd93060608e0925a384cb1be321de874 to your computer and use it in GitHub Desktop.
export const newMessage = subscriptionField('newMessage', {
type: nonNull('Message'),
subscribe(_, __, ctx) {
return ctx.sub.subscribe(`message-${ctx.userId}`);
},
resolve(obj: NewMessageEvent) {
return obj.message;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment