diff options
Diffstat (limited to 'docs/en/cowboy/2.2/guide/ws_handlers/index.html')
-rw-r--r-- | docs/en/cowboy/2.2/guide/ws_handlers/index.html | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/docs/en/cowboy/2.2/guide/ws_handlers/index.html b/docs/en/cowboy/2.2/guide/ws_handlers/index.html index 28f16a6a..1f000cc6 100644 --- a/docs/en/cowboy/2.2/guide/ws_handlers/index.html +++ b/docs/en/cowboy/2.2/guide/ws_handlers/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Websocket handlers</title> @@ -83,7 +83,7 @@ close the connection.</p></div> To establish a Websocket connection, you must switch to the <code>cowboy_websocket</code> module:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -118,7 +118,7 @@ Websocket, and provide the header:</p></div> <div class="paragraph"><p>This selection must be done in <code>init/2</code>. An example usage could be:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -155,7 +155,7 @@ from the connection process.</p></div> or be tied to the current pid, will not work as intended. The optional <code>websocket_init/1</code> can be used instead:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -166,7 +166,7 @@ http://www.gnu.org/software/src-highlite --> means that we can send frames to the client right after the upgrade:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -184,7 +184,7 @@ send frames back to the client or stop the connection.</p></div> <div class="paragraph"><p>The following snippet echoes back any text frame received and ignores all others:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -207,7 +207,7 @@ send frames to the client or stop the connection.</p></div> <div class="paragraph"><p>The following snippet forwards log messages to the client and ignores all others:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -224,7 +224,7 @@ http://www.gnu.org/software/src-highlite --> send zero, one or many frames to the client.</p></div> <div class="paragraph"><p>To send nothing, just return an ok tuple:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -232,7 +232,7 @@ http://www.gnu.org/software/src-highlite --> {<span style="color: #FF6600">ok</span>, <span style="color: #009900">State</span>}<span style="color: #990000">.</span></tt></pre></div></div> <div class="paragraph"><p>To send one frame, return a reply tuple with the frame to send:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -243,7 +243,7 @@ or close frames.</p></div> <div class="paragraph"><p>To send many frames at once, return a reply tuple with the list of frames to send:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -276,7 +276,7 @@ than needed.</p></div> for the connection. For example, this would make Cowboy close connections idle for more than 30 seconds:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -294,7 +294,7 @@ http://www.gnu.org/software/src-highlite --> after the callback returns.</p></div> <div class="paragraph"><p>Simply add an <code>hibernate</code> field to the ok or reply tuples:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -320,7 +320,7 @@ for the more busy connections.</p></div> Cowboy to stop it or by sending a close frame.</p></div> <div class="paragraph"><p>To tell Cowboy to close the connection, use a stop tuple:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -388,6 +388,8 @@ close frame will not be sent.</p></div> + <li><a href="/docs/en/cowboy/2.3/guide">2.3</a></li> + <li><a href="/docs/en/cowboy/2.2/guide">2.2</a></li> <li><a href="/docs/en/cowboy/2.1/guide">2.1</a></li> |