diff options
author | Stefan Strigler <[email protected]> | 2014-10-08 16:49:18 +0200 |
---|---|---|
committer | Stefan Strigler <[email protected]> | 2014-10-08 16:49:18 +0200 |
commit | 8fd3ff2d629fa13a52061e7db5c67a3ba6fe4429 (patch) | |
tree | 8337c1aff021ee40dccdac0c52a741b6bcb17929 /doc/src/guide/sub_protocols.ezdoc | |
parent | b87150c713fe16601b314451b2fe25b62bd820bb (diff) | |
download | cowboy-8fd3ff2d629fa13a52061e7db5c67a3ba6fe4429.tar.gz cowboy-8fd3ff2d629fa13a52061e7db5c67a3ba6fe4429.tar.bz2 cowboy-8fd3ff2d629fa13a52061e7db5c67a3ba6fe4429.zip |
change init/2 to return #state{} in documentation
Most examples returned 'Opts' as given by second argument to init. By
using '#state{}' the examples make it more clear that this is what is
being passed as 'State' to all subsequent callbacks (if any).
Diffstat (limited to 'doc/src/guide/sub_protocols.ezdoc')
-rw-r--r-- | doc/src/guide/sub_protocols.ezdoc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/src/guide/sub_protocols.ezdoc b/doc/src/guide/sub_protocols.ezdoc index d34f21e..54e57aa 100644 --- a/doc/src/guide/sub_protocols.ezdoc +++ b/doc/src/guide/sub_protocols.ezdoc @@ -14,8 +14,8 @@ the name of the sub protocol module. Everything past this point is handled by the sub protocol. ``` erlang -init(Req, Opts) -> - {cowboy_websocket, Req, Opts}. +init(Req, _Opts) -> + {cowboy_websocket, Req, #state{}}. ``` The return value may also have a `Timeout` value and/or the @@ -28,8 +28,8 @@ protocol, sets the timeout value to 5 seconds and enables hibernation: ``` erlang -init(Req, Opts) -> - {my_protocol, Req, Opts, 5000, hibernate}. +init(Req, _Opts) -> + {my_protocol, Req, #state{}, 5000, hibernate}. ``` If a sub protocol does not make use of these options, it should |