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