View Source Tamnoon.SocketHandler (Tamnoon v1.0.0-rc.3)
Tamnoon's :cowboy_websocket implementation. There should be no reason to interact with this
module, however, it is still documented to allow extensibility.
You can replace the module with another by setting the :socket_handler value in
Tamnoon.start_link/1's options.
Summary
Functions
Initiates the websocket connection.
Receives a websocket request and decodes it, sending it to the Tamnoon.MethodManager.route_request/3
function.
Handles messages from other BEAM processes. By default it is only used for handling
"pub" requests, and as such it simply forwards the message to websocket_handle/2.
Initiates the websocket and adds the client to the registry under the "clients" channel.
Functions
@spec init(:cowboy_req.req(), map()) :: {:cowboy_websocket, req :: :cowboy_req.req(), initial_state :: map(), opts :: map()}
Initiates the websocket connection.
@spec websocket_handle( {:text, tuple()}, map() ) :: {:reply, {:text, return_val :: String.t()}, new_state :: map()}
Receives a websocket request and decodes it, sending it to the Tamnoon.MethodManager.route_request/3
function.
@spec websocket_info(info :: map(), map()) :: {:reply, {:text, return_val :: String.t()}, new_state :: map()}
Handles messages from other BEAM processes. By default it is only used for handling
"pub" requests, and as such it simply forwards the message to websocket_handle/2.
Initiates the websocket and adds the client to the registry under the "clients" channel.