When a global client is used for 2 connections (wrongly), the 2nd connection gets the 1st connection message. #4304
-
When I try to fix a memory leak and also try to test Some explanation for the key points. The code declare My server logic is simple, when client connects it needs to send a login message with user_id , if the server finds the same user_id login with a different socket.id, it decides that this is the case that the same user login from a different client so it will emit The correct way is to make socketConnectBug.log Github doesn't allow to upload ts file so I change the file extension to log. The server codes
The client code
The result shows the second connection gets the logoff message. From the server logs it also confirms it is the 2nd connection disconnected. Why is that ?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi! There is a lot of global variables in your example! I'm not sure to completely understand your use case though. Could you please reduce it to the bare minimum, and include the code for the server? Thanks 👍 |
Beta Was this translation helpful? Give feedback.
Hi! There is a lot of global variables in your example! I'm not sure to completely understand your use case though.
Could you please reduce it to the bare minimum, and include the code for the server? Thanks 👍