socket.io: Don't reuse same-namespace connections
io('http://localhost/')
io('http://localhost/')
will create two connections moving forward.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 21 (15 by maintainers)
Commits related to this issue
- added tests for same-namespace new connection handling (https://github.com/Automattic/socket.io/issues/1956) — committed to socketio/socket.io-client by rauchg 9 years ago
- added tests for same-namespace new connection handling (https://github.com/Automattic/socket.io/issues/1956) — committed to holytiny/feathersjs-wxmp-socket.io-client by rauchg 9 years ago
- added tests for same-namespace new connection handling (https://github.com/Automattic/socket.io/issues/1956) — committed to sunrise30/socket.io-client by sunrise30 9 years ago
@rauchg , this breaking (and frankly, surprising) change never made it anywhere in the API documentation, or in the changelog of 1.4.0 for that matter.
I don’t think you realize that this approach to development is hostile to your users. Please consider my request at #2425 to at least let us mitigate the damage. I was personally bit by this undocumented change. I can’t trust your changelogs (history.md), and I can’t even rely on the official site doc.
please support
sameNamespaceMultiplex:true@rauchg @michael-luo
Please: Updating Documentation A Good Idea
Likely having a similar experience to @manad777 , I just spent hours debugging what seemed like a bug according to documentation. After narrowing it down to the
sameNamespacevariable I was able to track this back to this thread. I think to save other’s time in the future, this important default behaviour (and why it can’t be overridden, the benefits - which seem to be the ability to use different query parameters, etc.) should be documented to save time?Suggestion: Make Default and Overridable
Further, on a separate note, it may be likely that additional query parameters may not be something some folks are using. It appears that since this bug fix this is the default behaviour (i.e. same namespace connections requests result in new connections). However can I suggest that we have the ability to override this behaviour explicitly (i.e. change default behaviour only, but allow user to specify, for example,
sameNamespaceMultiplex:truein the options)? This way the developer at least has choice vs. being forced to keep track of connection objects.Since we have much discussion on this thread, can we have others who were previously involved weigh in on my suggestion above?
Many thanks.