Open richpjames opened 2 months ago
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?
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...
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