aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/loop_handlers.ezdoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-02-16 18:03:35 +0100
committerLoïc Hoguin <[email protected]>2015-02-16 18:03:35 +0100
commit4f2bbd2e5a08e10f98fc82c1f0a98a7c8649b3ee (patch)
tree0eaa05fc247994ac6f01f51c1979f7b321ca260c /doc/src/guide/loop_handlers.ezdoc
parent410662b29589214c1d825a027ec6b195c23e3ad6 (diff)
parent8fd3ff2d629fa13a52061e7db5c67a3ba6fe4429 (diff)
downloadcowboy-4f2bbd2e5a08e10f98fc82c1f0a98a7c8649b3ee.tar.gz
cowboy-4f2bbd2e5a08e10f98fc82c1f0a98a7c8649b3ee.tar.bz2
cowboy-4f2bbd2e5a08e10f98fc82c1f0a98a7c8649b3ee.zip
Merge branch 'master' of https://github.com/sstrigler/cowboy
Diffstat (limited to 'doc/src/guide/loop_handlers.ezdoc')
-rw-r--r--doc/src/guide/loop_handlers.ezdoc14
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/src/guide/loop_handlers.ezdoc b/doc/src/guide/loop_handlers.ezdoc
index 879013b..47893a9 100644
--- a/doc/src/guide/loop_handlers.ezdoc
+++ b/doc/src/guide/loop_handlers.ezdoc
@@ -34,8 +34,8 @@ process enter hibernation until a message is received.
This snippet enables the loop handler.
``` erlang
-init(Req, Opts) ->
- {cowboy_loop, Req, Opts}.
+init(Req, _Opts) ->
+ {cowboy_loop, Req, #state{}}.
```
However it is largely recommended that you set a timeout
@@ -43,8 +43,8 @@ value. The next example sets a timeout value of 30s and
also makes the process hibernate.
``` erlang
-init(Req, Opts) ->
- {cowboy_loop, Req, Opts, 30000, hibernate}.
+init(Req, _Opts) ->
+ {cowboy_loop, Req, #state{}, 30000, hibernate}.
```
:: Receive loop
@@ -94,9 +94,9 @@ a chunk is sent every time a `chunk` message is received,
and the loop is stopped by sending an `eof` message.
``` erlang
-init(Req, Opts) ->
- Req2 = cowboy_req:chunked_reply(200, [], Req),
- {cowboy_loop, Req2, Opts}.
+init(Req, _Opts) ->
+ Req2 = cowboy_req:chunked_reply(200, [], Req),
+ {cowboy_loop, Req2, #state{}}.
info(eof, Req, State) ->
{stop, Req, State};