mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Add an example with a Websocket close frame
Thanks benbro!
This commit is contained in:
parent
d27a373bc3
commit
50fd64ec34
1 changed files with 8 additions and 0 deletions
|
@ -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}.
|
||||
----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue