graphql-redis-subscriptions icon indicating copy to clipboard operation
graphql-redis-subscriptions copied to clipboard

Add a way to check status of connection to redis

Open Yasir5247 opened this issue 4 years ago • 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;
}

Yasir5247 avatar Nov 25 '20 12:11 Yasir5247

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

DrPep avatar Dec 08 '20 04:12 DrPep

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

davidyaha avatar Jan 27 '21 11:01 davidyaha