Open Sarathsr opened 1 year ago
any correction in below code ?? my node vr. is 18.16.1 graphql-redis-subscriptions version 2.6.0
const subs = new Redis({ host: "127.0.0.1", port: 6379, retryStrategy: (times) => { // reconnect after return Math.min(times 50, 2000); }, // db: 0, // password: process.env.REDIS_PASS, }); const pubs = new Redis({ host: "127.0.0.1", port: 6379, retryStrategy: (times) => { // reconnect after return Math.min(times 50, 2000); }, // db: 0, // password: process.env.REDIS_PASS, }); const redisIns = process.env.NODE_ENVIRONMENT === "production" ? { publisher: subs, subscriber: pubs, } : {}; const pubsub = new RedisPubSub({ ...redisIns, connectionListener: (err) => { if (err) { console.log("err", err); } else { console.log("Pubsub: Succefuly connected to redis"); } }, });
Updated my node version from node 14.16.0 to node 16.0.0.
const { RedisPubSub } = require('graphql-redis-subscriptions/dist/redis-pubsub'); export const pubSub = new RedisPubSub({ publisher: new Redis(readOptions), subscriber: new Redis(readOptions), })
The pubSub.publish stopped working. Working fine with Node 14.16.0