Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-redis package not compatible #458

Open
Darkbladecr opened this issue Oct 14, 2021 · 1 comment
Open

node-redis package not compatible #458

Darkbladecr opened this issue Oct 14, 2021 · 1 comment

Comments

@Darkbladecr
Copy link

import { RedisPubSub } from 'graphql-redis-subscriptions';
import { createClient } from 'redis';

const url = `redis://default:PASS@HOST:PORT`;

const client = createClient({
  socket: {
    url,
  },
});
client.on('error', (err) => console.log('Redis Client Error', err));

(async () => {
  await client.connect();
})();

export const pubsub = new RedisPubSub({
  publisher: client,
  subscriber: client,
});

Unfortunately when running this with the node-redis package it errors with:
Error: Cannot send commands in PubSub mode
The ioredis package works as intended and as shown in the readme.

@andrhamm
Copy link

andrhamm commented Jul 9, 2022

You need to pass a separate unique instance/client for the subscriber (like the readme shows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants