From 50fd64ec34abd6e8555a6c6cb08988f9353bf318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 29 Jan 2018 13:03:42 +0100 Subject: Add an example with a Websocket close frame Thanks benbro! --- doc/src/guide/ws_handlers.asciidoc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc/src') diff --git a/doc/src/guide/ws_handlers.asciidoc b/doc/src/guide/ws_handlers.asciidoc index a79d7e2..c944606 100644 --- a/doc/src/guide/ws_handlers.asciidoc +++ b/doc/src/guide/ws_handlers.asciidoc @@ -267,3 +267,11 @@ Sending a `close` frame will immediately initiate the closing of the Websocket connection. Note that when sending a list of frames that include a close frame, any frame found after the close frame will not be sent. + +The following example sends a close frame with a reason message: + +[source,erlang] +---- +websocket_info(_Info, State) -> + {reply, {close, 1000, <<"some-reason">>}, State}. +---- -- cgit v1.2.3