aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/sub_protocols.asciidoc
diff options
context:
space:
mode:
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