-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How to reconnect properly #2060
Labels
question
It is a question regarding the project
Comments
Also in the WIKI the "event based approach" is recommended. Just saying... |
The wiki is for the old version (3.* and below only). Just saying. The samples are the way to go. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is what your best practice sample says:
I figured the ConnectAsync() method will always fail with "you cannot connect while already connected".
So I need to wait for the Client to realize the connection has been dropped before I can reconnect.
There are two solutions to this.
Check for client.IsConnected - but that kind of defeats the purpose of the whole TryPing thing.
If I am not connected I don't need to ping because I know the ping will fail.
If I am connected and the ping fails I need to wait for the client to realize this too before I can make any reconnection attempts.
If the ping fails --> disconnect gracefully and start reconnecting immediately.
My preferred option would be this is handled by the library internally ;-)
So I'll start looking at the ManagedClient as well.
Which project is your question related to?
The text was updated successfully, but these errors were encountered: