mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Add cowboy_websocket:close_code/0
Also fixes a warning.
This commit is contained in:
parent
563e7d91ce
commit
cd680706cd
1 changed files with 6 additions and 2 deletions
|
@ -24,9 +24,12 @@
|
|||
%% Internal.
|
||||
-export([handler_loop/4]).
|
||||
|
||||
-type close_code() :: 1000..4999.
|
||||
-export_type([close_code/0]).
|
||||
|
||||
-type frame() :: close | ping | pong
|
||||
| {text | binary | close | ping | pong, binary()}
|
||||
| {close, 1000..4999, binary()}.
|
||||
| {close, close_code(), binary()}.
|
||||
-export_type([frame/0]).
|
||||
|
||||
-type opcode() :: 0 | 1 | 2 | 8 | 9 | 10.
|
||||
|
@ -645,7 +648,8 @@ websocket_send_many([Frame|Tail], State) ->
|
|||
Error -> Error
|
||||
end.
|
||||
|
||||
-spec websocket_close(#state{}, Req, any(), {atom(), atom()})
|
||||
-spec websocket_close(#state{}, Req, any(),
|
||||
{atom(), atom()} | {remote, close_code(), binary()})
|
||||
-> {ok, Req, cowboy_middleware:env()}
|
||||
when Req::cowboy_req:req().
|
||||
websocket_close(State=#state{socket=Socket, transport=Transport},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue