react-apollo-network-status icon indicating copy to clipboard operation
react-apollo-network-status copied to clipboard

Is My Apollo Client Connected to the Server?

Open erosval opened this issue 5 years ago • 1 comments

Do you think it is possible to check if a connection "is active" if you are using type WebSocketLink connections?

Using Subscriptions I would need to know if the connection to the server drops but I don't find any simple way to do it. I've only found this example: Is My Apollo Client Connected to the Server?.

I think it can be an excellent enhancement, anyway, nice idea and nice component!

erosval avatar Feb 12 '20 17:02 erosval

Hmm, I'm not sure if this library is in a good position to detect this. As mentioned in the blog article you have to set up event handlers on the SubscriptionClient instance.

So I guess what you have to do is create the instance, set up the listeners and pass that instance to apollo-link-ws.

This library acts as another link in the chain. I don't know of any way how you can look through existing links to find the subscription client …

amannn avatar Feb 17 '20 07:02 amannn