davidyaha/graphql-redis-subscriptions

Add a way to check status of connection to redis

Yasir5247 opened this issue · 2 comments

export default async () => {

    const redisConnection = new RedisPubSub({
        connection: {
            host: redis.host,
            port: redis.port,
            retry_strategy: options => Math.max(options.attempt * 100, 3000),
        }
    });

    console.log('redisConnection', redisConnection)

    return redisConnection;
}
DrPep commented

I was curious about this. It appears you can observe the status of the underlying connection to either subscriber (and presumably the publisher) with:

redisConnection.redisSubscriber.status (using your above example). This flag will transition from connecting to connected when the connection is established. HTH

Hey @Yasir5247 @DrPep, I'd happy to merge any PR that exposes the connection state for simpler usage.