Closed cpisto closed 12 years ago
I think that's proper fix.
Can you create pull request?
Thanks.
Sure, have it for you shortly.
I submitted a pull for this solution, but there are some alternatives that may be better?
An error could be returned when connecting to an already connected endpoint, or the later connect could be silently ignored (and a new connection not created in the server)..
Disconnecting and and closing the existing connection works, but what if there was some state in there that should have been kept? etc..
Thoughts?
Somewhat unfortunate the socket.io spec doesn't specify what should happen in this situation. I guess i can setup the actual socket.io server and see what it does ;)
So, near as I can tell according to ~ line 411 of https://github.com/LearnBoost/socket.io/blob/master/lib/manager.js the official socket.io server silently ignores connects to an already connected endpoint, I will create a new pull request with a fix in that vein.
OK, proper pull request submitted.
In the course of writing my own socket.io client, I discovered that a "misbehaving" client that connects to the same endpoint more than once causes any existing connection to that endpoint to never be disconnected in the server (this may be specific to the multiplexed example as it keeps an internal reference to connection and may be interacting poorly with expected garbage collection behavior).
My fix was this:
Any thoughts on what the proper fix should be?