chaperon v0.3.1 Chaperon.Action.WebSocket View Source

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

Link to this type

msg_type()

View Source
msg_type() :: :text | :binary

Link to this section Functions

Link to this function

assign_for_action(session, action, ws_conn, ws_url)

View Source

Returns a Chaperon.WebSocket.Close action with options.

Link to this function

connect(path, options \\ [])

View Source

Returns a Chaperon.WebSocket.Connect action for a given path.

Link to this function

delete_for_action(session, action)

View Source
Link to this function

for_action(session, action)

View Source

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)
Link to this function

reset_websockets(session)

View Source
Link to this function

send(message, options \\ [])

View Source
send(any(), Keword.t()) :: %Chaperon.Action.WebSocket.SendMessage{
  message: term(),
  options: term(),
  type: term()
}

Returns a Chaperon.WebSocket.SendMessage action with a given message and options.