diff options
author | Loïc Hoguin <[email protected]> | 2013-01-17 16:22:05 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-01-17 16:22:05 +0100 |
commit | cd680706cd0aaff9f92481490babbbffcd117b0a (patch) | |
tree | c747cf983bab5adf3f290a1f63fedb1166bf157b /src | |
parent | 563e7d91ce79a1e60a9c21f2e2a7a9e0bccfe922 (diff) | |
download | cowboy-cd680706cd0aaff9f92481490babbbffcd117b0a.tar.gz cowboy-cd680706cd0aaff9f92481490babbbffcd117b0a.tar.bz2 cowboy-cd680706cd0aaff9f92481490babbbffcd117b0a.zip |
Add cowboy_websocket:close_code/0
Also fixes a warning.
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_websocket.erl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 4553aef..1b2ad3b 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -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}, |