diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/websocket/src/ws_handler.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/websocket/src/ws_handler.erl b/examples/websocket/src/ws_handler.erl index eaa9284..69d8d7b 100644 --- a/examples/websocket/src/ws_handler.erl +++ b/examples/websocket/src/ws_handler.erl @@ -1,13 +1,17 @@ -module(ws_handler). -export([init/2]). +-export([websocket_init/2]). -export([websocket_handle/3]). -export([websocket_info/3]). init(Req, Opts) -> - erlang:start_timer(1000, self(), <<"Hello!">>), {cowboy_websocket, Req, Opts}. +websocket_init(Req, State) -> + erlang:start_timer(1000, self(), <<"Hello!">>), + {ok, Req, State}. + websocket_handle({text, Msg}, Req, State) -> {reply, {text, << "That's what she said! ", Msg/binary >>}, Req, State}; websocket_handle(_Data, Req, State) -> |