View Source ChannelsHandler.Plug behaviour (channel_handler v0.1.1)
A ChannelHandler.Plug
, is a function or module that takes the connection
socket, the payload and the current handler bindings, and either returns a
modified version of each, or directly replies to the client, halting further
processing.
The plug can either be a module implementing the ChannelHandler.Plug
behaviour,
or an function of arity 4
examples
Examples
def call(socket, _payload, _bindings, _opts) do
case authenticated?(socket) do
{:cont, socket, payload, bindings}
else
{:reply, {:error, "Not authenticated"}, socket}
end
end