View Source nova_websocket behaviour (nova v0.10.1)

Summary

Types

-type call_result() ::
    {ok, State :: map()} |
    {ok, State :: map(), hibernate} |
    {reply, OutFrame :: cow_ws:frame() | [OutFrame :: cow_ws:frame()], State :: map()} |
    {reply, OutFrame :: cow_ws:frame() | [OutFrame :: cow_ws:frame()], State :: map(), hibernate} |
    {stop, State :: map()}.
-type in_frame() :: ping | pong | {text | binary | ping | pong, binary()}.

Callbacks

-callback init(State :: map()) -> {ok, State0 :: map()} | any().
-callback terminate(Reason :: reason(), PartialReq :: map(), State :: map()) -> ok.
-callback websocket_handle(Frame :: in_frame(), State :: map()) -> call_result().
-callback websocket_info(Info :: any(), State :: map()) -> call_result().
Link to this callback

websocket_init/1

View Source (optional)
-callback websocket_init(State :: map()) -> Result :: call_result().