diff options
author | Loïc Hoguin <[email protected]> | 2019-10-06 16:51:27 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-10-06 16:51:27 +0200 |
commit | 3977f2b96fb8cc2164bfe28ee094b3e661a2fad9 (patch) | |
tree | b709721f8f69a4ee87bbfab8359915bfd201bb10 /examples | |
parent | 2b3852635115ad0aeeade9aeb88f285cfcd870b1 (diff) | |
download | cowboy-3977f2b96fb8cc2164bfe28ee094b3e661a2fad9.tar.gz cowboy-3977f2b96fb8cc2164bfe28ee094b3e661a2fad9.tar.bz2 cowboy-3977f2b96fb8cc2164bfe28ee094b3e661a2fad9.zip |
Document the commands based Websocket interface
The old interface with ok|reply|stop tuples is deprecated.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/websocket/src/ws_h.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/websocket/src/ws_h.erl b/examples/websocket/src/ws_h.erl index 63055df..ba2b844 100644 --- a/examples/websocket/src/ws_h.erl +++ b/examples/websocket/src/ws_h.erl @@ -10,15 +10,15 @@ init(Req, Opts) -> websocket_init(State) -> erlang:start_timer(1000, self(), <<"Hello!">>), - {ok, State}. + {[], State}. websocket_handle({text, Msg}, State) -> - {reply, {text, << "That's what she said! ", Msg/binary >>}, State}; + {[{text, << "That's what she said! ", Msg/binary >>}], State}; websocket_handle(_Data, State) -> - {ok, State}. + {[], State}. websocket_info({timeout, _Ref, Msg}, State) -> erlang:start_timer(1000, self(), <<"How' you doin'?">>), - {reply, {text, Msg}, State}; + {[{text, Msg}], State}; websocket_info(_Info, State) -> - {ok, State}. + {[], State}. |