Wobserver v0.1.8 Wobserver.Web.Client View Source
Modules handles WebSocket connects to the client.
Link to this section Summary
Functions
Handles the command
given by the websocket interface
Handles process messages
Starts the websocket client
Initialize the websocket connection
Handles incoming messages from the websocket client
Handles incoming messages from processes
Initialize the websocket connection by calling the implementing client
Gracefully handles websocked terminate
Link to this section Functions
client_handle(atom | [atom], state :: map) :: {:reply, atom | [atom], map, map} | {:reply, atom | [atom], map} | {:noreply, map}
Handles the command
given by the websocket interface.
The current state
is passed and can be modified.
Returns a map as state.
client_info(any, state :: map) :: {:noreply, map}
Handles process messages.
Should not be used, the do
is ignored and the state
is returned unmodified.
Starts the websocket client.
Returns a map as state.
init(any, :cowboy_req.req, any) :: {:upgrade, :protocol, :cowboy_websocket}
Initialize the websocket connection.
The req
cowboy request and options
are passed, but unused in the setup.
websocket_handle({:text, String.t}, req :: :cowboy_req.req, state :: any) :: {:reply, {:text, String.t}, :cowboy_req.req, any} | {:ok, :cowboy_req.req, any}
Handles incoming messages from the websocket client.
The message
is parsed and passed on to the client, which responds with an update state
and possible reply.
The req
is ignored.
websocket_info(message :: any, req :: :cowboy_req.req, state :: any) :: {:reply, {:text, String.t}, :cowboy_req.req, any} | {:ok, :cowboy_req.req, any}
Handles incoming messages from processes.
The message
is passed on to the client, which responds with an update state
and possible reply.
The req
is ignored.
websocket_init(any, req :: :cowboy_req.req, any) :: {:ok, :cowboy_req.req, any, non_neg_integer}
Initialize the websocket connection by calling the implementing client.
The req
cowboy request is passed along to the client.
The type
and options
are passed, but unused in the setup.
websocket_terminate({atom, any}, :cowboy_req.req, any) :: :ok
Gracefully handles websocked terminate.
The reason
, req
and state
are ignored.