Просмотр исходного кода

Add an example with a Websocket close frame

Thanks benbro!
Loïc Hoguin 7 лет назад
Родитель
Сommit
50fd64ec34
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      doc/src/guide/ws_handlers.asciidoc

+ 8 - 0
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}.
+----