{"repo":"davidyaha/graphql-redis-subscriptions","free":true,"listed":false,"github":"https://github.com/davidyaha/graphql-redis-subscriptions","clone":"git clone https://github.com/davidyaha/graphql-redis-subscriptions.git","description":"A graphql subscriptions implementation using redis and apollo's graphql-subscriptions","language":"TypeScript","stars":1118,"topics":["redis","graphql-subscriptions","redis-subscriptions","graphql"],"license":"MIT","category":"databases-storage","readme_excerpt":"graphql-redis-subscriptions This package implements the PubSubEngine Interface from the graphql-subscriptions package and also the new AsyncIterator interface. It allows you to connect your subscriptions manager to a Redis Pub Sub mechanism to support multiple subscription manager instances. Installation At first, install the graphql-redis-subscriptions package: As the graphql-subscriptions package is declared as a peer dependency, you might receive warning about an unmet peer dependency if it's not installed already by one of your other packages. In that case you also need to install it too: Using as AsyncIterator Define your GraphQL schema with a Subscription type: Now, let's create a simple RedisPubSub instance: Now, implement your Subscriptions type resolver, using the pubsub.asyncIterator to map the event you need: Subscriptions resolvers are not a function, but an object with subscribe method, that returns AsyncIterable . Calling the method asyncIterator of the RedisPubSub instance will send redis a SUBSCRIBE message to the topic provided and will return an AsyncIterator binded to the RedisPubSub instance and listens to any event published on that topic. Now, the GraphQL engine knows that somethingChanged is a subscription, and every time we will use pubsub.publish over this topic, the RedisPubSub will PUBLISH the event over redis to all other subscribed instances and those in their turn will emit the event to GraphQL using the next callback given by the GraphQL engine.","default_branch":null,"files":null,"tree":[],"storefront":"/r/davidyaha","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/davidyaha/graphql-redis-subscriptions/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}