PushEx.Behaviour.Socket behaviour (PushEx v2.2.0)

Implementable functions that are used in the flow of socket/channel creation. It is crucial to implement secure connect/join functions for all applications.

Summary

Callbacks

channel_join(bitstring, map, t)

@callback channel_join(bitstring(), map(), Phoenix.Socket.t()) ::
  {:ok, Phoenix.Socket.t()}
  | {:ok, reply :: map(), Phoenix.Socket.t()}
  | {:error, reason :: map()}

See Phoenix.Channel.join/3

presence_identifier(t)

@callback presence_identifier(Phoenix.Socket.t()) :: bitstring()

See Phoenix.Presence.track/4 key

socket_connect(map, t)

@callback socket_connect(map(), Phoenix.Socket.t()) :: {:ok, Phoenix.Socket.t()} | :error

See Phoenix.Socket.connect/3

socket_id(t)

@callback socket_id(Phoenix.Socket.t()) :: bitstring()

See Phoenix.Socket.id/1