question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example Request: Subscriptions with RedisPubSub

See original GitHub issue

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));
        }
      ),
    },
  },
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
n1ru4lcommented, Nov 5, 2022

@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

1reaction
JoJ123commented, Jul 4, 2022

Yeah, but it could solve the next 2-3 weeks 😃 Thank you so far, let’s close the request.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found