Late behaviour (late v0.2.0)
Example
defmodule MyConnection do
@behaviour Late
@impl true
def init(_args) do
{:ok, %{from: nil}}
end
@impl true
def handle_call({:something, query}, from, state) do
{:noreply, stuff}
end
@impl true
def handle_in({:text, text}, state) do
{:reply, [frame], new_state}
end
end
Summary
Callbacks
Invoked after connecting or reconnecting.
Types
Link to this type
call_result()
Link to this type
disconnect_reason()
@type disconnect_reason() :: {:close, code :: non_neg_integer() | nil, reason :: binary() | nil}
Link to this type
frame()
@type frame() :: Mint.WebSocket.shorthand_frame() | Mint.WebSocket.frame()
Link to this type
state()
@type state() :: term()
Callbacks
@callback handle_call(term(), {pid(), term()}, state()) :: call_result()
@callback handle_connect(state()) :: call_result()
Invoked after connecting or reconnecting.
@callback handle_disconnect(disconnect_reason(), state()) :: {:ok, state()}
@callback handle_in(frame(), state()) :: call_result()
@callback handle_info(any(), state()) :: call_result()
Link to this callback
init(term)
Functions
Link to this function
call(server, message, timeout \\ 5000)
Calls the given server.
Wrapper for :gen_statem.call/3
.
Link to this function
connected(arg1, message, state)
Link to this function
reply(from, reply)
Replies to the given client.
Wrapper for :gen_statem.reply/2
.
Link to this function