diff options
Diffstat (limited to 'doc/src/guide/loop_handlers.ezdoc')
-rw-r--r-- | doc/src/guide/loop_handlers.ezdoc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/src/guide/loop_handlers.ezdoc b/doc/src/guide/loop_handlers.ezdoc index b1c033f..445854c 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(_Type, Req, _Opts) -> - {loop, Req, undefined_state}. +init(Req, Opts) -> + {long_polling, Req, Opts}. ``` 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(_Type, Req, _Opts) -> - {loop, Req, undefined_state, 30000, hibernate}. +init(Req, Opts) -> + {long_polling, Req, Opts, 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(_Type, Req, _Opts) -> +init(Req, Opts) -> Req2 = cowboy_req:chunked_reply(200, [], Req), - {loop, Req2, undefined_state}. + {long_polling, Req2, Opts}. info(eof, Req, State) -> {ok, Req, State}; |