Phoenix.Socket
Holds state for every channel pointing to its transport.
Socket Fields
assigns
- The map of socket assigns, default:%{}
channel
- The channel module where this socket originatedendpoint
- The endpoint module where this socket originatedjoined
- If the socket has effectively joined the channelpubsub_server
- The registered name of the socket’s PubSub serverref
- The latest ref sent by the clienttopic
- The string topic, ie"rooms:123"
transport
- The socket’s transport, ie:Phoenix.Transports.WebSocket
transport_pid
- The pid of the socket’s transport process
Summary↑
assign(socket, key, value) | Adds key/value pair to socket assigns |
put_topic(socket, topic) | Sets topic of socket |
Types ↑
Functions
Adds key/value pair to socket assigns.
Examples
iex> socket.assigns[:token]
nil
iex> socket = assign(socket, :token, "bar")
iex> socket.assigns[:token]
"bar"
Sets topic of socket.