Connection Specific Variables in nodeJS / Socket.io
I am developing an application in nodeJS that uses socket.io for interactive gameplay. Inside the socket.on ('connection') callback block, I have declared several variables. From what I can tell, these variables are connection specific and there will be an instance for every callback caused by a socket connection for every client.
During my tests, I tried in two browsers and was able to play two independent game sessions at the same time, which made me validate this kind of these variables.
However, when in a more lively environment, I noticed the actions of other players appearing as actions on my screen. I am not using broadcast anywhere, just emits inside the connection block, so I am puzzled as to why I can see this happening.
Is my assumption about connection-specific variables wrong? Or is there a more subtle application-specific reason that can happen?
source to share