diff options
Diffstat (limited to 'src/cowboy_websocket_handler.erl')
-rw-r--r-- | src/cowboy_websocket_handler.erl | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/cowboy_websocket_handler.erl b/src/cowboy_websocket_handler.erl index 177e5f6..a6a036b 100644 --- a/src/cowboy_websocket_handler.erl +++ b/src/cowboy_websocket_handler.erl @@ -16,21 +16,23 @@ -type opts() :: any(). -type state() :: any(). --type terminate_reason() :: {normal, shutdown} - | {normal, timeout} - | {error, closed} - | {remote, closed} - | {remote, cowboy_websocket:close_code(), binary()} - | {error, badencoding} - | {error, badframe} - | {error, atom()}. +%% @todo see terminate +%-type terminate_reason() :: {normal, shutdown} +% | {normal, timeout} +% | {error, closed} +% | {remote, closed} +% | {remote, cowboy_websocket:close_code(), binary()} +% | {error, badencoding} +% | {error, badframe} +% | {error, atom()}. --callback websocket_init(atom(), Req, opts()) - -> {ok, Req, state()} - | {ok, Req, state(), hibernate} - | {ok, Req, state(), timeout()} - | {ok, Req, state(), timeout(), hibernate} - | {shutdown, Req} +-callback init(Req, opts()) + -> {http, Req, state()} + | {long_polling | rest | ws | module(), Req, state()} + | {long_polling | rest | ws | module(), Req, state(), hibernate} + | {long_polling | rest | ws | module(), Req, state(), timeout()} + | {long_polling | rest | ws | module(), Req, state(), timeout(), hibernate} + | {shutdown, Req, state()} when Req::cowboy_req:req(). -callback websocket_handle({text | binary | ping | pong, binary()}, Req, State) -> {ok, Req, State} @@ -46,5 +48,4 @@ | {reply, cowboy_websocket:frame() | [cowboy_websocket:frame()], Req, State, hibernate} | {shutdown, Req, State} when Req::cowboy_req:req(), State::state(). --callback websocket_terminate(terminate_reason(), cowboy_req:req(), state()) - -> ok. +%% @todo optional -callback terminate(terminate_reason(), cowboy_req:req(), state()) -> ok. |