View Source ow_websocket (overworld v2.0.0)

Summary

Functions

Handler is initialized for any new connection and logs the foreign IP

Terminate callback for cleanup processes

The websocket handler passes any binary message down to the protocol decoder for further processing. All other messages are discarded.

websocket_info is triggered when a message from another erlang process comes into this handler process.

Set up the initial state of the websocket handler

Types

-type ws_result() :: {ok, any()} | {reply, [binary(), ...], any()}.

Functions

-spec init(cowboy_req:req(), any()) -> {cowboy_websocket, cowboy_req:req(), any()}.

Handler is initialized for any new connection and logs the foreign IP

Link to this function

terminate(Reason, Req, Pid)

View Source
-spec terminate(any(), cowboy_req:req(), pid()) -> ok.

Terminate callback for cleanup processes

Link to this function

websocket_handle(Frame, Pid)

View Source
-spec websocket_handle({binary, [binary(), ...]}, pos_integer()) -> ws_result().

The websocket handler passes any binary message down to the protocol decoder for further processing. All other messages are discarded.

Link to this function

websocket_info(Info, SessionPid)

View Source
-spec websocket_info({From, client_msg, Msg}, SessionPid) -> Reply
                        when
                            From :: pid(),
                            Msg :: binary(),
                            SessionPid :: pid(),
                            Reply :: {reply, {binary, Msg1}, SessionPid1},
                            Msg1 :: binary(),
                            SessionPid1 :: pid().

websocket_info is triggered when a message from another erlang process comes into this handler process.

-spec websocket_init(any()) -> {ok, any()}.

Set up the initial state of the websocket handler