aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/loop_handlers.asciidoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/guide/loop_handlers.asciidoc')
-rw-r--r--doc/src/guide/loop_handlers.asciidoc12
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};