Skip to content

Instantly share code, notes, and snippets.

@Akryum
Created November 1, 2016 14:46
Show Gist options
  • Save Akryum/79ab2c13848d20e0b89469b194c1077a to your computer and use it in GitHub Desktop.
Save Akryum/79ab2c13848d20e0b89469b194c1077a to your computer and use it in GitHub Desktop.
GraphQL server subscriptions
import { PubSub, SubscriptionManager } from 'graphql-subscriptions';
import schema from './schema';
const pubsub = new PubSub();
const subscriptionManager = new SubscriptionManager({
schema,
pubsub,
setupFunctions: {
tagAdded: (options, args) => {
console.log(args);
return {
tagAdded: tag => {
// This is not called
console.log(tag);
return tag.type === args.type;
},
};
},
},
});
export { subscriptionManager, pubsub };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment