GraphQL subscriptions is a simple npm package that lets you wire up GraphQL with a pubsub system (like Redis) to implement subscriptions in GraphQL. You can use it with any GraphQL client and server (not only Apollo). To begin with GraphQL subscriptions, start by defining a GraphQL Subscription type in your schema. Next, add the Subscription type to your schema definition. Now, let's create a simple PubSub instance - it is a simple pubsub implementation, based on EventEmitter. Alternative EventEmitter implementations can be passed by an options object to the PubSub constructor. Now, implement your Subscriptions type resolver, using the pubsub.asyncIterator to map the event you need. When publishing data to subscribers, we need to make sure that each subscriber gets only the data it needs.

Features

  • Channels Mapping
  • Payload Manipulation
  • Usage with callback listeners
  • Custom AsyncIterator Wrappers
  • PubSub Implementations
  • You can use it with any GraphQL client and server (not only Apollo)

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow graphql-subscriptions

graphql-subscriptions Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of graphql-subscriptions!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Software Development Software

Registered

2023-03-02