EpochtalkServerWeb.UserSocket (epochtalk_server v0.1.0)
Handles User
socket connection and authentication.
Link to this section Summary
Functions
Connects to socket and authenticates if token is provided, otherwise connects anonymously.
Returns socket id "user:<user_id>"
if authenticated and nil
if not authenticated.
Link to this section Functions
Link to this function
connect_maybe_auth(params, socket, connect_info)
@spec connect_maybe_auth( params :: map(), socket :: Phoenix.Socket.t(), connect_info :: map() ) :: {:ok, Phoenix.Socket.t()} | {:error, term()} | :error
Connects to socket and authenticates if token is provided, otherwise connects anonymously.
Link to this function
maybe_socket_id(socket)
@spec maybe_socket_id(socket :: Phoenix.Socket.t()) :: String.t() | nil
Returns socket id "user:<user_id>"
if authenticated and nil
if not authenticated.