Phoenix.Socket.Transport

Phoenix.Socket.Transport behaviour

API for building transports.

This module describes what is required to build a Phoenix transport. The transport sits between the socket and channels, forwarding client messages to channels and vice-versa.

A transport is responsible for:

  • Implementing the transport behaviour
  • Establishing the socket connection
  • Handling of incoming messages
  • Handling of outgoing messages
  • Managing channels
  • Providing secure defaults

The transport behaviour

The transport requires two functions:

  • default_config/0 - returns the default transport configuration to be merged when the transport is declared in the socket module

  • handlers/0 - returns a map of handlers. For example, if the transport can be run cowboy, it just need to specify the appropria