educative.io

How server handle messages from different users chatting with same user?


#1

The server can maintain a hash table, where “key” would be the UserID and “value” would be the connection object. So whenever the server receives a message for a user, it looks up that user in the hash table to find the connection object and sends the message on the open request.

-As per above text, if server deliver any message meant for a user ID to a same connection object, how we handle 2 simultaneous chat sessions with 2 different people.Can you please explain.