Websocket 1-1 messaging

plz only a question about websocket messaging

I’m building a webchat app with Elixir using .transport behavior,

for rooms I use PG: of Erlang where to store session groups and messages broadcasting

for 1:1 messaging I do this:
onInit (onConnect) I get the id of the websocket and insert it into a map
when user 1 -> send a message to user 2 -> I use IO.puts ( map[id], message)

as far I have read this is the scalable way, avoiding to use map reduce and list iteration at every message, but directly target lookups

sounds correct to you, or do you have better hints for 1-1 messaging?

thank you

1 Like