-
Notifications
You must be signed in to change notification settings - Fork 50
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
Client will hang there if the server side crashed after the connection has already been established. #38
Comments
The client hangs on https://github.com/donovanhide/eventsource/blob/3ed64d21fb0b6bd8b49bcfec08f3004daee8723d/stream.go#L193 I've been playing with this to find a fix but I'm not entirely sure my approach is correct yet. It seems that there's no error detection so I set the stream.isClosed if I encounter an error during Decode(). Let me share what I've done so far. If someone can finish or correct what I've tried if, please do so. My comments are prefixed with WC
if I shutdown server and then restart it, I can reconnect and receive events but I'm getting errors which I suspect are lingering http.Requests from the failed connect attempts.
|
For future reference: stream, err := eventsource.SubscribeWith("", client, request)
if err != nil {
log.Fatal(err)
}
go func() {
for true {
streamError := <-stream.Errors
log.Debug(streamError)
}
}() |
Let's see the example below:
Server side:
Client side:
You'll find that after the connection has been extablished, and the client side has print logs like this:
But, if you kill the server side process now, you can find that client just hang there, and no errors occurs.
And there is no retry actions.
How to solve this, guys ?
The text was updated successfully, but these errors were encountered: