diff options
Diffstat (limited to 'doc/src/guide/ws_handlers.ezdoc')
-rw-r--r-- | doc/src/guide/ws_handlers.ezdoc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/src/guide/ws_handlers.ezdoc b/doc/src/guide/ws_handlers.ezdoc index 9f0fcbb..a0cfc29 100644 --- a/doc/src/guide/ws_handlers.ezdoc +++ b/doc/src/guide/ws_handlers.ezdoc @@ -42,7 +42,7 @@ init(Req, _Opts) -> <<"mychat2">>, Req), {ok, Req2, #state{}}; false -> - {shutdown, Req, undefined} + {stop, Req, undefined} end end. ``` @@ -75,7 +75,7 @@ ping or pong frame arrives from the client. Note that in the case of ping and pong frames, no action is expected as Cowboy automatically replies to ping frames. -The handler can decide to send frames to the socket, shutdown +The handler can decide to send frames to the socket, stop or just continue without sending anything. The following snippet echoes back any text frame received and @@ -93,7 +93,7 @@ websocket_handle(_Frame, Req, State) -> Cowboy will call `websocket_info/3` whenever an Erlang message arrives. -The handler can decide to send frames to the socket, shutdown +The handler can decide to send frames to the socket, stop or just continue without sending anything. The following snippet forwards any `log` message to the socket @@ -109,7 +109,8 @@ websocket_info(_Info, Req, State) -> :: Sending frames to the socket Cowboy allows sending either a single frame or a list of -frames to the socket. Any frame can be sent: text, binary, ping, +frames to the socket, in which case the frames are sent +sequentially. Any frame can be sent: text, binary, ping, pong or close frames. The following example sends three frames using a single `reply` |