-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Default room name is not socket id #2475
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
Comments
A socket ID is not the same as a room ID. The socket ID is unique per client. So the above is sending 'some msg' to that specific client and not a room. Think of a room as a group of people and a socket as a singular person in this context. |
Also Take note 'some msg' is the event. So you might be looking to do something like |
But the document says that every socket joins a room of its socket id. I think this is related to #2405 , that client and server returns different format of socket id. |
You're right. Just ignore the guy above. I lost two hours trying to figure out what was going on. Turns out when I did THISID = socket.id it got stored as "EgdohcmzQZnc_FzHAAAA" instead of ('/#' + "EgdohcmzQZnc_FzHAAAA") which is the true socket id. So server side socket.id is /#EgdohcmzQZnc_FzHAAAA, but client side socket.id is EgdohcmzQZnc_FzHAAAA. Who is responsible for this? |
Dig a little bit in the source I found that it's this line |
PR merged. |
I'm using socket.io 1.4.5.
if I do
the message will not be emitted.
after digging a little bit I found that I should prepend
/#
before socke id.The text was updated successfully, but these errors were encountered: