Skip to content
Discussion options

You must be logged in to vote

The sid is not great to be used as user identification, because as you well noticed, it changes when there is a reconnection (not only due to a refresh, but also due to network problems outside of the user's control). What you need to do is map the sid to your own user ID in the connect handler, then use your own user IDs when you map to your game entities. Then if you receive a reconnection you can update your user ID to the new sid value.

To get the rooms a client is in, use the rooms() method.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by gus3inov
Comment options

You must be logged in to vote
1 reply
@miguelgrinberg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants