diff options
author | Loïc Hoguin <[email protected]> | 2016-08-29 12:39:49 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-29 12:40:03 +0200 |
commit | c807880f7ac73f813b2660ea81a00f7712a4e793 (patch) | |
tree | ba1d09e9b177f230665a80513b33fbd532000ce4 /docs/en/cowboy/2.0/guide/sub_protocols.asciidoc | |
parent | b1df25a7d9cda697513650659b781b55b40898f8 (diff) | |
download | ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.gz ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.bz2 ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.zip |
Add old mailing list archives
Diffstat (limited to 'docs/en/cowboy/2.0/guide/sub_protocols.asciidoc')
-rw-r--r-- | docs/en/cowboy/2.0/guide/sub_protocols.asciidoc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/en/cowboy/2.0/guide/sub_protocols.asciidoc b/docs/en/cowboy/2.0/guide/sub_protocols.asciidoc index 63fd52be..5332eec4 100644 --- a/docs/en/cowboy/2.0/guide/sub_protocols.asciidoc +++ b/docs/en/cowboy/2.0/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 |