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
Take "" and "/" as equivalent namespaces on server #1729
Conversation
On server, `.of(name)` should use the same key in `.nsps` object for "" and "/" Important to use `String(name)` and `===` to keep out keys that don't cast to ""
"" and "/" namespaces are checked for equivalence on server and client
@@ -324,6 +324,8 @@ Server.prototype.onconnection = function(conn){ | |||
*/ | |||
|
|||
Server.prototype.of = function(name, fn){ | |||
if (String(name) === '') name = '/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should make this more general and check if name starts with /
and add it if not, instead of hardcoding the default namespace case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!
Let me go ahead and make the change then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid idea
Awesome work! |
Hold on, tests coming in for the general case... |
That's it! |
Looks good. Great work! |
Take "" and "/" as equivalent namespaces on server
Thanks! |
@anupbishnoi There are lot's of issues around leaving a namespace and then failing to reconnect to it. But who am I to decide for you... ;) |
Awesome! Great suggestion, @peteruithoven! There are lots of issues regarding reconnection in general. You could pick any of those up, @asyncanup, and start investigating. :) |
On server,
.of(name)
should use the same key in.nsps
object for "" and "/"Important to use
String(name)
and===
to keep out keys that don't cast to ""