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
Duplicate connection seen when the server goes down and comes up again #89
Comments
I'm unable to reproduce this with the example. How can we reproduce this? |
Thanks for the reply. I created a simple sse server (using the sse-server.js from example) in VS code and running it. (Note - I never bring down the client at any point) Please see the attachments below... |
Sidenote : seems to have solved this precise issue. However - In the spirit of completeness...I hope the issue gets resolved in this amazing module as well. Cheers |
If @mwolson submits a pull request with tests, we'd be happy to include this in the next release. |
@sakathvenu while trying to write a test for this, I wasn't able to repro the problem anymore, even with the same version of node.js I see in your debugger, and even using VSCode Insiders Build on OS X with a launch.json file to set up debug profiles for the sse-server and sse-client. Can you give me the git commit ID of the version of eventsource you have locally (using git show-ref HEAD), and your OS version? |
End of message |
I'm also seeing the same behavior. When the connection drops, two Using the browser's native I'm testing with Chromium 65. |
I know this is an old issue report, but we have seen the issue as well. As mentioned previously by @sakathvenu , this issue does appear to have been addressed quite simply in the forked https://github.com/tigertext/eventsource version of this module. Here is the commit. |
ditto |
Updates: Just notice that this PR #125 seems to fix this issue, when will it be released?Got this issue too. Similar case with @sakathvenu , I hacked into the source file and found same thing as @shesek noted, when connection drops, two events are fired, one for http response close, the other for http request error, then I think the key to this issue is to avoid call function Although this commit in tigertext/eventsource seems resolved this issue, but it didn't prevent multiple workers from establish a connection between server and client, and that may end up with duplicate TCP connections. It works fine from first look beacause only one connection was set for data handling, but it do create multiple connections (can be checked by |
This package was last released in 2018. yarn add https://github.com/EventSource/eventsource#46fe04e03e54f4129a28bf75b3a1e5f4ab68b52a |
Lets suppose the eventsource client has connected to the server and is receiving messages.
Lets suppose the server goes down
The eventsource client callback onerror is fired
The eventsource client keeps re-trying to connect
The server comes online again
Observation - eventsource client now makes two connections to the server.
Further - each message that the server sends is received twice by the eventsource client, due to the duplicate connection.
Is the above not a valid usecase to be supported by the module?
Curious to know the reason why it was not considered?
The text was updated successfully, but these errors were encountered: