phoenix_gen_socket_client v4.0.0 Phoenix.Channels.GenSocketClient.Transport behaviour View Source

Transport contract used by Phoenix.Channels.GenSocketClient

The implementation has following responsibilities:

  • Starts the transport process and links it to the caller. It is always assumed that the caller process is the socket process.
  • Pushes messages to the server when the push/2 function is invoked.
  • Notifies the socket process about various events by invoking notify_* functions from the Phoenix.Channels.GenSocketClient module.

Link to this section Summary

Callbacks

Invoked to push the frame.

Invoked from the socket process to start the transport process.

Link to this section Types

Specs

frame() :: {:text | :binary, GenSocketClient.encoded_message()}

Specs

transport_pid() :: pid()

Link to this section Callbacks

Link to this callback

push(transport_pid, frame)

View Source

Specs

push(transport_pid(), frame()) :: :ok

Invoked to push the frame.

Specs

start_link(url :: String.t(), GenSocketClient.transport_opts()) ::
  {:ok, transport_pid()} | {:error, any()}

Invoked from the socket process to start the transport process.