graphql-subscriptions-promised
GraphQL subscriptions is a simple npm package that lets you wire up GraphQL with a pubsub system (like Redis) to implement subscriptions in GraphQL.
Installation
npm install graphql-subscriptions-promised
Example usage
;; // PubSub can be easily replaced, for example with https://github.com/davidyaha/graphql-redis-subscriptionsconst pubsub = ; const subscriptionManager = schema pubsub // setupFunctions maps from subscription name to a map of channel names and their filter functions // in this case it will subscribe to the commentAddedChannel and re-run the subscription query // every time a new comment is posted whose repository name matches args.repoFullName. setupFunctions: newCommentsChannel: commentrepository_name === argsrepoFullName ; // start a subscriptionsubscriptionManager; // publish to the channelpubsub; // the query will run, and the callback will print// {// data: {// commentAdded: {// id: 123,// content: 'Test',// createdBy: {// username: 'helfer',// }// }// }// }