Reconnecting graphql subscription

231 views Asked by At

I am using apollo client and graphql-ws library for subscription.

I have the following requirement. Server redeploys every morning and that time the existing subscription gets completed. I need to reconnect when the service is up which is not happening.

I have tried setInterval onComplete but that will start calling until we have data and can lead to multiple subscriptions

1

There are 1 answers

1
phry On

Best thing to do would be to set the retry-related options for graphql-ws.

That way it will look just like a running connection to your application and it reconnects internally.