server side socket.data properties are cloned? #4935
-
Issue/observation/confusion: It looks like socket.data.xxx is somehow re-assigned to a different object with the same properties, and I'm very confused. I have middleware to attach an 'active user' to a given socket instance. Here is a simplified version that assumes there is only ever one user.
Now create the server & use middleware:
Now connect with two clients and hit the info endpoint, and the response is as follows:
I would have expected both object references to remain pointing to the original activeUser/activeUserHandle as defined in the middleware (and thus expected Is this intended behaviour, and if so is it mentioned anywhere in the docs? Or perhaps I've misunderstood something? Any thoughts much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi! I see two possible explanations:
Could you please check? |
Beta Was this translation helpful? Give feedback.
Hi! I see two possible explanations:
io.fetchSockets()
returns all the connections in the clusterdata
attributeCould you please check?