diff options
author | Loïc Hoguin <[email protected]> | 2019-10-16 09:48:31 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-10-16 09:48:31 +0200 |
commit | 8459bebceb9533948193774371cbd9fd571b78ea (patch) | |
tree | dd8e5eb8aa21e68b47f2526a3db9a276ea0d4327 /docs/en/cowboy/2.2/guide/loop_handlers | |
parent | 31cedd105e5f6ecfbfcb925d4703cdf7b5ae114f (diff) | |
download | ninenines.eu-8459bebceb9533948193774371cbd9fd571b78ea.tar.gz ninenines.eu-8459bebceb9533948193774371cbd9fd571b78ea.tar.bz2 ninenines.eu-8459bebceb9533948193774371cbd9fd571b78ea.zip |
Cowboy 2.7.0
Diffstat (limited to 'docs/en/cowboy/2.2/guide/loop_handlers')
-rw-r--r-- | docs/en/cowboy/2.2/guide/loop_handlers/index.html | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/en/cowboy/2.2/guide/loop_handlers/index.html b/docs/en/cowboy/2.2/guide/loop_handlers/index.html index 282581a3..ff5d3ae7 100644 --- a/docs/en/cowboy/2.2/guide/loop_handlers/index.html +++ b/docs/en/cowboy/2.2/guide/loop_handlers/index.html @@ -70,7 +70,7 @@ <h2 id="_initialization">Initialization</h2> <p>The <code>init/2</code> function must return a <code>cowboy_loop</code> tuple to enable loop handler behavior. This tuple may optionally contain a timeout value and/or the atom <code>hibernate</code> to make the process enter hibernation until a message is received.</p> <p>This snippet enables the loop handler:</p> -<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -78,7 +78,7 @@ http://www.gnu.org/software/src-highlite --> {<font color="#FF6600">cowboy_loop</font>, <font color="#009900">Req</font>, <font color="#009900">State</font>}<font color="#990000">.</font></tt></pre> </div></div> <p>This also makes the process hibernate:</p> -<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite --> <h2 id="_receive_loop">Receive loop</h2> <p>Once initialized, Cowboy will wait for messages to arrive in the process' mailbox. When a message arrives, Cowboy calls the <code>info/3</code> function with the message, the Req object and the handler's state.</p> <p>The following snippet sends a reply when it receives a <code>reply</code> message from another process, or waits for another message otherwise.</p> -<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite --> <h2 id="_streaming_loop">Streaming loop</h2> <p>Another common case well suited for loop handlers is streaming data received in the form of Erlang messages. This can be done by initiating a chunked reply in the <code>init/2</code> callback and then using <code>cowboy_req:chunk/2</code> every time a message is received.</p> <p>The following snippet does exactly that. As you can see a chunk is sent every time an <code>event</code> message is received, and the loop is stopped by sending an <code>eof</code> message.</p> -<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9 by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -184,6 +184,8 @@ http://www.gnu.org/software/src-highlite --> + <li><a href="/docs/en/cowboy/2.7/guide">2.7</a></li> + <li><a href="/docs/en/cowboy/2.6/guide">2.6</a></li> <li><a href="/docs/en/cowboy/2.5/guide">2.5</a></li> |