-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling loss of websocket connection #70
Comments
The Therefore reconnection should be implemented in In order to reconnect I also think I should resend all the OperationTypes with the type GQL_START (start) such that the operations will continue to receive data? So the initial idea of how to support this could be:
Do you have any suggrestions to this? |
I'm afraid you're definitely over-stretching my C# skills there! So I'm afraid I can't really offer anything on how to achieve it - happy to try anything out though and see how it fits with me as a 'user'. |
And if the re-connect could use a progressive backoff interval.... ;) |
By the way, you may need/want to watch out for the situation of StartListen in GraphQLSubscriptionClient catching an exception e.g. from the app's DataReceived handler - currently it just calls OnDisconnected. |
Eventhandlers should generally don't throw exceptions. But you are right the library should handle the exception instead of just calling OnDisconnected. |
Just coming from the point-of-view of a scruffy library user - quite possibly me lol. |
Would you create a PR for this change? :) |
For the possibility of app handler Excepting?
I just noticed the possibility whilst trying out what happens currently in such situations. Might be best to try out the strategy for disconnect in general, and I'll feed back on my observations?
|
Yep I think it should not disconnect if the vent handler is throwing an exception. I will work on the disconnection logic in the next weeks - it would be fine to have some observation on how it should work. |
I've modified my client lib/app to use this library, and taken a look at various connection situations. My top-level app is able to catch: the server being offline; the server rejecting the websocket connection; and subscription errors such as mismatch between client classes and the server schema. |
(Me again lol)
An area I'm concerned about is if a subscription websocket gets disconnected - loss of network, server restart etc.
I will be supplying an intermediate library for people to write their own 'as simple as possible' client app for receiving specific subscription messages from my server, and I would prefer not to burden them with reconnection headaches. - i.e. have either my library or [ideally!] SAHB.GraphQLClient deal with retrying on first subscribe, and with reconnecting if the websocket goes down after that.
I see that OnDisconnected() is empty, so maybe it's 'work in progress' - but it's quite a key area for me which would be great to see enhanced.
I appreciate that it might not be an easy one!
The text was updated successfully, but these errors were encountered: