View Source Chaperon.Action.WebSocket (doma_chaperon v0.3.2)
Helper functions for creating WebSocket actions.
Link to this section Summary
Functions
Returns a Chaperon.WebSocket.Close action with options.
Returns a Chaperon.WebSocket.Connect action for a given path.
Returns a Chaperon.WebSocket.ReceiveMessage action with options.
Returns a Chaperon.WebSocket.SendMessage action with a given message and
options.
Link to this section Types
@type msg_type() :: :text | :binary
Link to this section Functions
Returns a Chaperon.WebSocket.Close action with options.
Returns a Chaperon.WebSocket.Connect action for a given path.
Returns a Chaperon.WebSocket.ReceiveMessage action with options.
options can include a result handler callback to be called once the message
arrived.
Example:
Chaperon.Action.WebSocket.recv(with_result: fn (session, result) ->
session
|> Chaperon.Session.assign(ws_message: result)
end)
@spec send(any(), Keword.t()) :: Chaperon.Action.WebSocket.SendMessage.t()
Returns a Chaperon.WebSocket.SendMessage action with a given message and
options.