acl v0.1.1 AclWeb.UserSocket
Link to this section Summary
Link to this section Functions
Link to this function
connect(params, socket, connect_info)
Link to this function
id(socket)
Identifies the socket connection.
Socket IDs are topics that allow you to identify all sockets for a given user:
def id(socket), do: "users_socket:#{socket.assigns.user_id}"
Would allow you to broadcast a "disconnect" event and terminate all active sockets and channels for a given user:
MyApp.Endpoint.broadcast("users_socket:" <> user.id, "disconnect", %{})
Returning nil
makes this socket anonymous.
Callback implementation for Phoenix.Socket.id/1
.