Skip to content
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

Merged
merged 4 commits into from Aug 20, 2014

Conversation

asyncanup
Copy link
Contributor

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 ""

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
@asyncanup
Copy link
Contributor Author

@@ -324,6 +324,8 @@ Server.prototype.onconnection = function(conn){
*/

Server.prototype.of = function(name, fn){
if (String(name) === '') name = '/';
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid idea

@rase-
Copy link
Contributor

rase- commented Aug 19, 2014

Awesome work!

@asyncanup
Copy link
Contributor Author

Hold on, tests coming in for the general case...
Will also describe the general case properly in the commit message.

@asyncanup
Copy link
Contributor Author

That's it!
Simplified the added tests to test specifically for only what changed.
Waiting for comments..

@rase-
Copy link
Contributor

rase- commented Aug 20, 2014

Looks good. Great work!

rase- added a commit that referenced this pull request Aug 20, 2014
Take "" and "/" as equivalent namespaces on server
@rase- rase- merged commit 5863903 into socketio:master Aug 20, 2014
@asyncanup
Copy link
Contributor Author

Thanks!
I've got some free time these days, and would love to help out with any open issues you need resolved. Maybe point me to some I could start looking at? :)

@peteruithoven
Copy link

@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... ;)

@rase-
Copy link
Contributor

rase- commented Aug 21, 2014

Awesome! Great suggestion, @peteruithoven! There are lots of issues regarding reconnection in general. You could pick any of those up, @asyncanup, and start investigating. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants