Can a socket subscribe to more than one topic simultaneously?
Yep, it does so via your Endpoint’s
subscribe method, check hexdocs in the phoenix endpoint help to see the call and the format of the messages it sends you.
id(Phoenix.Socket.t) :: String.t | nil
Identifies the socket connection.
Socket id’s are topics that allow you to identify all sockets for a given user:
Isn’t it one socket per user that handles all the communication? Why would a user need more than one socket?
Imagine that they have more than one tab open, they will have a socket per webpage, just how it works. The only time I’ve used the id for the socket itself is when I want to kill all the active sockets of a user, which I do when they log out.
@OvermindDL1 thanks a lot for that