# How to detect the disconnect of GraphQLWsLink?

**URL:** <https://community.apollographql.com/t/how-to-detect-the-disconnect-of-graphqlwslink/6496>\
**Category:** Client SDKs\
**Tags:** client, web\
**Created:** [July 15, 2023, 8:51pm UTC](https://community.apollographql.com/t/how-to-detect-the-disconnect-of-graphqlwslink/6496 "2023-07-15T20:51:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karol\_Pysniak](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/karol_pysniak/32/4442_2.png) [@Karol\_Pysniak](https://community.apollographql.com/u/Karol_Pysniak)\
**Post date:** [July 15, 2023, 8:51pm UTC](https://community.apollographql.com/t/how-to-detect-the-disconnect-of-graphqlwslink/6496/1 "2023-07-15T20:51:22Z")

</div>

I am using GraphQLWsLink to connect to my graphql server in react. However, sometimes the connection is down and after a few attempts apollo client does not attempt reconnecting.

Is there a way I could detect when the websocket connection is down? What would be the best way of forcing reconnecting?

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [July 17, 2023, 10:43am UTC](https://community.apollographql.com/t/how-to-detect-the-disconnect-of-graphqlwslink/6496/2 "2023-07-17T10:43:31Z")

</div>

Hi Karol,  
this is something that happens outside of the `GraphQLWsLink` - in the `client` instance itself.

There are a bunch of options to handle reconnects - see [Interface: ClientOptions\<P\> – GraphQL WS](https://the-guild.dev/graphql/ws/docs/interfaces/client.ClientOptions#shouldretry)

On the Apollo Client side, you will only receive an error with a “Socket closed” error message if all of those “internal” reconnects fail - at that point you would probably need to kick off the whole subscription again from your component, but if you already retried reconnecting on `Client` level there is probably little hope it will actually be able to connect then, either.

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:48pm UTC](https://community.apollographql.com/t/how-to-detect-the-disconnect-of-graphqlwslink/6496/3 "2025-02-06T20:48:32Z")

</div>


