Example Request: Subscriptions with RedisPubSub
See original GitHub issueHey, I would like to request an example of GraphQL Yoga Subscriptions with RedisPubSub and asynchronous filtering.
We managed to migrate from ApolloServer to Yoga, but we still have to rely on the withFilter
Function from apollo. This is working fine, but it would be easier / cleaner if we could directly make use filter
function from GraphQL Yoga. Like described here: https://www.graphql-yoga.com/docs/features/subscriptions#filter-and-map-values
import { withFilter } from 'apollo-server-express';
{
Subscription: {
testSub: {
subscribe: withFilter(
(root: any, args: any, context: GraphQLModules.Context) =>
context.injector.get(testModuleConfig).pubsub.asyncIterator("TEST_TOPIC"),
(root, args, context: GraphQLModules.Context) => {
// Here we can filter
return new Promise(resolve => resolve(true / false));
}
),
},
},
}
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
GraphQL subscriptions with Redis Pub Sub
This will monitor your server so you can see the subscriptions and publishes arrive on the server. What makes GraphQL subscriptions special?
Read more >Redis Pub/Sub
The replies to subscription and unsubscribing operations are sent in the form of messages, so that the client can just read a coherent...
Read more >GraphQL Subscriptions with Redis PubSub - DJay's Tech Diary
Graphql Redis Subscription allows you to connect your subscriptions manager to a Redis PubSub mechanism to support multiple subscription-manager ...
Read more >How to use the graphql-redis-subscriptions.RedisPubSub ...
flushall(); } const schema = genSchema() as any; applyMiddleware(schema, middleware); const pubsub = new RedisPubSub( process.env.NODE_ENV === "production" ? { ...
Read more >Going Real-Time with Redis Pub/Sub - Toptal
Whenever a web node needs observes a change (for example a new message is created by the user), it will use Redis Pub/Sub...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@inc16sec filtering events is described in the advanced section in the Subscription documentation: https://www.the-guild.dev/graphql/yoga-server/v3/features/subscriptions#advanced
Yeah, but it could solve the next 2-3 weeks 😃 Thank you so far, let’s close the request.