-
Notifications
You must be signed in to change notification settings - Fork 179
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
Example for client to reconnect? #52
Comments
In the case of a connection dropping, a Subscribe() will be retried with exponential backoff. It will keep reconnecting until client.Unsubscribe() is called, which stops the client goroutine. If you want to keep track of disconnects, you can use the callback like so: client.OnDisconnect(func(c *sse.Client){
log.Println("disconnected!")
}) |
Thanks for the explanation. Hope you don't mind me expanding my question but when it reconnects, isn't it supposed to only get messages after Last-Event-ID? Currently, it gets replayed all messages from the start. |
You're right in that's how it should function, however if the stream you're reading from isn't sending any If you're able to please send some of the raw data from the stream, that would be super helpful. Thanks! |
Would some kind soul please show me how to setup the Client to reconnect if the server closes connection? I'm guessing it has something to do with Client.disconnectdb but I have no idea how to use this.
Is this what the TestClientChanReconnect method is testing? I see the httptest.Server closing connections but how did the client reconnect?
The text was updated successfully, but these errors were encountered: