aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_websocket.asciidoc
diff options
context:
space:
mode:
authorAlex Prut <[email protected]>2016-08-31 12:42:50 +0200
committerAlex Prut <[email protected]>2016-08-31 12:42:50 +0200
commitb58093a3c7a25b6ea2acbce7bfb71fbc77486901 (patch)
tree41d4c3c571851cc705b6663cb5dd80c559408b55 /doc/src/manual/cowboy_websocket.asciidoc
parentbae10829bafb46e5a1abf4e7eb42fde352d6f0c3 (diff)
downloadcowboy-b58093a3c7a25b6ea2acbce7bfb71fbc77486901.tar.gz
cowboy-b58093a3c7a25b6ea2acbce7bfb71fbc77486901.tar.bz2
cowboy-b58093a3c7a25b6ea2acbce7bfb71fbc77486901.zip
Update websocket documentation: based on https://github.com/ninenines/cowboy/blob/master/examples/websocket/src/ws_handler.erl
Diffstat (limited to 'doc/src/manual/cowboy_websocket.asciidoc')
-rw-r--r--doc/src/manual/cowboy_websocket.asciidoc28
1 files changed, 13 insertions, 15 deletions
diff --git a/doc/src/manual/cowboy_websocket.asciidoc b/doc/src/manual/cowboy_websocket.asciidoc
index ac9016b..b76d5e1 100644
--- a/doc/src/manual/cowboy_websocket.asciidoc
+++ b/doc/src/manual/cowboy_websocket.asciidoc
@@ -13,7 +13,7 @@ be implemented by handlers. The `init/2` and `terminate/3`
callbacks are common to all handler types and are documented
in the manual for the link:cowboy_handler.asciidoc[cowboy_handler] module.
-The `websocket_handle/3` and `websocket_info/3` callbacks are
+The `websocket_handle/2` and `websocket_info/2` callbacks are
specific to Websocket handlers and will be called as many times
as necessary until the Websocket connection is closed.
@@ -84,18 +84,17 @@ timeout::
== Callbacks
-=== websocket_handle(InFrame, Req, State) -> Ret
+=== websocket_handle(InFrame, State) -> Ret
[source,erlang]
----
-Ret = {ok, Req, State}
- | {ok, Req, State, hibernate}
- | {reply, OutFrame | [OutFrame], Req, State}
- | {reply, OutFrame | [OutFrame], Req, State, hibernate}
- | {stop, Req, State}
+Ret = {ok, State}
+ | {ok, State, hibernate}
+ | {reply, OutFrame | [OutFrame], State}
+ | {reply, OutFrame | [OutFrame], State, hibernate}
+ | {stop, State}
InFrame = {text | binary | ping | pong, binary()}
-Req = cowboy_req:req()
State = any()
OutFrame = cow_ws:frame()
----
@@ -113,18 +112,17 @@ The `hibernate` option will hibernate the process until
it receives new data from the Websocket connection or an
Erlang message.
-=== websocket_info(Info, Req, State) -> Ret
+=== websocket_info(Info, State) -> Ret
[source,erlang]
----
-Ret = {ok, Req, State}
- | {ok, Req, State, hibernate}
- | {reply, OutFrame | [OutFrame], Req, State}
- | {reply, OutFrame | [OutFrame], Req, State, hibernate}
- | {stop, Req, State}
+Ret = {ok, State}
+ | {ok, State, hibernate}
+ | {reply, OutFrame | [OutFrame], State}
+ | {reply, OutFrame | [OutFrame], State, hibernate}
+ | {stop, State}
Info = any()
-Req = cowboy_req:req()
State = any()
OutFrame = cow_ws:frame()
----