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

Remove reliance on socketIds #212

Open
richpjames opened this issue Sep 2, 2024 · 2 comments
Open

Remove reliance on socketIds #212

richpjames opened this issue Sep 2, 2024 · 2 comments
Milestone

Comments

@richpjames
Copy link
Contributor

According to the Socket.IO docs we shouldn't use a socket's ID for anything other than debugging.
We currently use it as a unique identifier for a client.
There's more information here: https://socket.io/docs/v4/server-api/#socketid

There's an example of where we could go with this here: https://github.com/socketio/socket.io/tree/main/examples/private-messaging
But it looks relatively complicated to me so maybe there is a simpler route we can take

@richpjames richpjames added this to the v2 milestone Sep 2, 2024
@yndajas
Copy link
Contributor

yndajas commented Sep 2, 2024

Could we just create a separate ID in the server when a player joins, and return that ID to the socket that joined (without using its socket ID), which it can then pass instead of the socket ID with any future events?

@yndajas
Copy link
Contributor

yndajas commented Sep 2, 2024

Although setting it in a cookie might be more disconnect/refresh-proof, which would make things more user-friendly! But it might allow users to change their ID to someone else's...

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

No branches or pull requests

2 participants