Tuesday, 2 June 2020

Tracking socket connections in memory

Hello all, I'm hoping to get some insight on a general high level question regarding web sockets.I'm working on an app where every user who signs in will be connected, however sockets will only be able to direct message each other. This seems fine, but I'm seeing a lot of things onine about tracking sockets in memory and I'm wondering if this is considered best practice, or at what point I should be concerned about performance issues?​Would redis make sense for something like this? Or is it still totally ok to create a single object in memory that pairs a userId (in mongo) to a socket? Again, all users are connected at sign in, however only direct messages will be allowed, there is no "global exchange" if that makes sense.​The reason I am asking is that the client who initiates the message will need some identifier to the client who will receive the message. I thought about using the SocketId that is already inside the socket object however if the client disconnects and then reconnnects , it would be a different socket id.

Submitted June 02, 2020 at 03:18PM by TaGeuelePutain

No comments:

Post a Comment