Phoenix.Socket

Phoenix.Socket behaviour

Defines a socket and its state.

Phoenix.Socket is used as a module for establishing and maintaining the socket state via the Phoenix.Socket struct.

Once connected to a socket, incoming and outgoing events are routed to channels. The incoming client data is routed to channels via transports. It is the responsibility of the socket to tie transports and channels together.

By default, Phoenix supports both websockets and longpoll transports. For example:

transport :websocket, Phoenix.Transports.WebSocket

The command above means incoming socket connections can be done via the WebSocket transport. Events are routed by topic to channels:

channel "room:lo