Purpose of def id function in user_socket

what is this for i dont understand the purpose or use of this function in user_socket.ex

def id(socket), do: “users_socket:#{socket.assigns.user_id}”

is this a unique topic for user if that can i connect to that from client(JavaScript) ?

solved

  1. you can’t access that id from the client

  2. user connected to channel through socket so every connected user have socket and id is to idenitfy user specific socket

  3. Also note that if the user opens the page in multiple tabs, or even in multiple devices in multiple locations, the disconnect broadcast will get to everyone of them since they’re identified by that string, it’s like a “topic” for the user