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. As the graphql-subscriptions package is declared as a peer dependency, you might receive a warning about an unmet peer dependency if it's not installed already by one of your other packages. 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.

Features

  • Define your GraphQL schema with a Subscription type
  • Implement your Subscriptions type resolver, using the pubsub.asyncIterator to map the event you need
  • Use a pattern on subscription
  • Use both arguments and payload to filter events
  • Dynamically create a topic based on subscription args passed on the query
  • Configure RedisPubSub

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow graphql-redis-subscriptions

graphql-redis-subscriptions Web Site

nel_h2
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

Build gen AI apps with an all-in-one modern database: MongoDB Atlas

MongoDB Atlas provides built-in vector search and a flexible document model so developers can build, scale, and run gen AI apps without stitching together multiple databases. From LLM integration to semantic search, Atlas simplifies your AI architecture—and it’s free to get started.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

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

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Software Development Software

Registered

2023-03-06