From 7839f1367194813c70d7e223a476f96a62b298ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 24 Aug 2016 17:25:33 +0200 Subject: More 2.0 documentation updates Still incomplete. --- doc/src/guide/loop_handlers.asciidoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/src/guide/loop_handlers.asciidoc') 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}; -- cgit v1.2.3