aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/sub_protocols.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-08-24 17:25:33 +0200
committerLoïc Hoguin <[email protected]>2016-08-24 17:25:33 +0200
commit7839f1367194813c70d7e223a476f96a62b298ae (patch)
treed5f7be7d443c47dfc67856e9c10474232cb79686 /doc/src/guide/sub_protocols.asciidoc
parentb9ad02d3057e78ff82dacbd38042e33073c4bc75 (diff)
downloadcowboy-7839f1367194813c70d7e223a476f96a62b298ae.tar.gz
cowboy-7839f1367194813c70d7e223a476f96a62b298ae.tar.bz2
cowboy-7839f1367194813c70d7e223a476f96a62b298ae.zip
More 2.0 documentation updates
Still incomplete.
Diffstat (limited to 'doc/src/guide/sub_protocols.asciidoc')
-rw-r--r--doc/src/guide/sub_protocols.asciidoc10
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/src/guide/sub_protocols.asciidoc b/doc/src/guide/sub_protocols.asciidoc
index 63fd52b..5332eec 100644
--- a/doc/src/guide/sub_protocols.asciidoc
+++ b/doc/src/guide/sub_protocols.asciidoc
@@ -16,8 +16,8 @@ is handled by the sub protocol.
[source,erlang]
----
-init(Req, _Opts) ->
- {cowboy_websocket, Req, #state{}}.
+init(Req, State) ->
+ {cowboy_websocket, Req, State}.
----
The return value may also have a `Timeout` value and/or the
@@ -29,10 +29,12 @@ The following snippet switches to the `my_protocol` sub
protocol, sets the timeout value to 5 seconds and enables
hibernation:
+// @todo Yeah maybe what we really need is an Opts map.
+
[source,erlang]
----
-init(Req, _Opts) ->
- {my_protocol, Req, #state{}, 5000, hibernate}.
+init(Req, State) ->
+ {my_protocol, Req, State, 5000, hibernate}.
----
If a sub protocol does not make use of these options, it should