-
Notifications
You must be signed in to change notification settings - Fork 584
Closed
Description
Hey,
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));
}
),
},
},
}
Metadata
Metadata
Assignees
Labels
No labels