-
Notifications
You must be signed in to change notification settings - Fork 180
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
Feature Request: Let's implement a client.AutoReconnect() method on lost connections. #75
Comments
I faced with that issue as well. |
@quarckster I solved this by implementing the suggested code above and it works perfectly |
+1 |
code: #145 |
This was referenced Feb 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it would be a great addition to the library if we could implement an auto reconnecting feature for the Client.go
Right now the
Client
will actually keep trying to connect with the amount of attempts decided by the backoff.Retry() method, but only IF theClient
has been started with an unreachable stream (server) from start and then it will stop when it has established a connection with the streamBut the
Client
will not try again in the same way if it loses the connection from a stream it already was connected to, because the readLoop() method will detect this conditionerr == io.EOF
and returnnill
to theerChan
and thereby killing of thebackoff.Retry()
An very simple idea to a solution for this would be something like this:
This works and I have tried it on a Live-server.
The text was updated successfully, but these errors were encountered: