websocket design for messagin app
can i get help me with my websocket design
i have a message app like discord, it has servers groupchats and dms, and they all have channels. messages are tied to the channels.
when a user goes in the app, i have a map that maps channel_id to a list of websocket connections. When someone sends a message, it will broadcast that message to everyone in the channel.
now i am wondering if i should have the client listen to all dms and groupchats, but for server channls listen for messages in the active channel.
to do that, i would have to remove and add the user's connection to the new active channel, which requires knowledge of the previous active channel, and which websocket connection belongs to the user.
and there is also the problem if the same user opens another tab, now i dont know which websocket connection belongs to which tab.
is my approach cooked
0 Replies