diff options
author | Loïc Hoguin <[email protected]> | 2016-08-24 17:25:33 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-24 17:25:33 +0200 |
commit | 7839f1367194813c70d7e223a476f96a62b298ae (patch) | |
tree | d5f7be7d443c47dfc67856e9c10474232cb79686 /doc/src/guide/loop_handlers.asciidoc | |
parent | b9ad02d3057e78ff82dacbd38042e33073c4bc75 (diff) | |
download | cowboy-7839f1367194813c70d7e223a476f96a62b298ae.tar.gz cowboy-7839f1367194813c70d7e223a476f96a62b298ae.tar.bz2 cowboy-7839f1367194813c70d7e223a476f96a62b298ae.zip |
More 2.0 documentation updates
Still incomplete.
Diffstat (limited to 'doc/src/guide/loop_handlers.asciidoc')
-rw-r--r-- | doc/src/guide/loop_handlers.asciidoc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/src/guide/loop_handlers.asciidoc b/doc/src/guide/loop_handlers.asciidoc index d3655e5..c0195ea 100644 --- a/doc/src/guide/loop_handlers.asciidoc +++ b/doc/src/guide/loop_handlers.asciidoc @@ -38,8 +38,8 @@ This snippet enables the loop handler. [source,erlang] ---- -init(Req, _Opts) -> - {cowboy_loop, Req, #state{}}. +init(Req, State) -> + {cowboy_loop, Req, State}. ---- However it is largely recommended that you set a timeout @@ -48,8 +48,8 @@ also makes the process hibernate. [source,erlang] ---- -init(Req, _Opts) -> - {cowboy_loop, Req, #state{}, 30000, hibernate}. +init(Req, State) -> + {cowboy_loop, Req, State, 30000, hibernate}. ---- === Receive loop @@ -101,9 +101,9 @@ and the loop is stopped by sending an `eof` message. [source,erlang] ---- -init(Req, _Opts) -> +init(Req, State) -> Req2 = cowboy_req:chunked_reply(200, [], Req), - {cowboy_loop, Req2, #state{}}. + {cowboy_loop, Req2, State}. info(eof, Req, State) -> {stop, Req, State}; |