aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-11-28 19:37:15 +0100
committerLoïc Hoguin <[email protected]>2012-11-28 19:37:15 +0100
commit71420169554375eba4d9c2a7c11d87bd944748cc (patch)
tree6bfa5e27aa5812a595507b3c280cb62b7e36676e
parent45dd67741f62512baaea3d57dd822374c06536ca (diff)
downloadcowboy-71420169554375eba4d9c2a7c11d87bd944748cc.tar.gz
cowboy-71420169554375eba4d9c2a7c11d87bd944748cc.tar.bz2
cowboy-71420169554375eba4d9c2a7c11d87bd944748cc.zip
Update the cowboy_websocket_handler specs
We can send many payloads at once.
-rw-r--r--src/cowboy_websocket_handler.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cowboy_websocket_handler.erl b/src/cowboy_websocket_handler.erl
index 34749ba..1b942fd 100644
--- a/src/cowboy_websocket_handler.erl
+++ b/src/cowboy_websocket_handler.erl
@@ -50,6 +50,7 @@
-type opts() :: any().
-type state() :: any().
+-type payload() :: {text | binary | ping | pong, binary()}.
-type terminate_reason() :: {normal, closed}
| {normal, timeout}
| {error, closed}
@@ -66,15 +67,15 @@
-callback websocket_handle({text | binary | ping | pong, binary()}, Req, State)
-> {ok, Req, State}
| {ok, Req, State, hibernate}
- | {reply, {text | binary | ping | pong, binary()}, Req, State}
- | {reply, {text | binary | ping | pong, binary()}, Req, State, hibernate}
+ | {reply, payload() | [payload()], Req, State}
+ | {reply, payload() | [payload()], Req, State, hibernate}
| {shutdown, Req, State}
when Req::cowboy_req:req(), State::state().
-callback websocket_info(any(), Req, State)
-> {ok, Req, State}
| {ok, Req, State, hibernate}
- | {reply, {text | binary | ping | pong, binary()}, Req, State}
- | {reply, {text | binary | ping | pong, binary()}, Req, State, hibernate}
+ | {reply, payload() | [payload()], Req, State}
+ | {reply, payload() | [payload()], Req, State, hibernate}
| {shutdown, Req, State}
when Req::cowboy_req:req(), State::state().
-callback websocket_terminate(terminate_reason(), cowboy_req:req(), state())