diff options
Diffstat (limited to 'docs/en/gun/1.0/guide/protocols')
-rw-r--r-- | docs/en/gun/1.0/guide/protocols/index.html | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/docs/en/gun/1.0/guide/protocols/index.html b/docs/en/gun/1.0/guide/protocols/index.html index b94891f0..00d70ad6 100644 --- a/docs/en/gun/1.0/guide/protocols/index.html +++ b/docs/en/gun/1.0/guide/protocols/index.html @@ -7,8 +7,6 @@ <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.37.1" /> - <title>Nine Nines: Supported protocols</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'> @@ -73,27 +71,31 @@ operations available to them.</p></div> sends a request, the server sends back a response.</p></div> <div class="paragraph"><p>Gun provides convenience functions for performing GET, HEAD, OPTIONS, POST, PATCH, PUT, and DELETE requests. All these -functions are aliases of <code>gun:request/{4,5,6}</code> for each respective +functions are aliases of <code>gun:request/4,5,6</code> for the respective methods. Gun also provides a <code>gun:data/4</code> function for streaming the request body.</p></div> +<div class="paragraph"><p>Gun will send a <code>gun_inform</code> message for every intermediate +informational responses received. They will always be sent +before the <code>gun_response</code> message.</p></div> <div class="paragraph"><p>Gun will send a <code>gun_response</code> message for every response received, followed by zero or more <code>gun_data</code> messages for -the response body. If something goes wrong, a <code>gun_error</code> +the response body, which is optionally terminated by a +<code>gun_trailers</code> message. If something goes wrong, a <code>gun_error</code> will be sent instead.</p></div> <div class="paragraph"><p>Gun provides convenience functions for dealing with messages. -The <code>gun:await/{2,3,4}</code> function waits for a response to the given -request, and the <code>gun:await_body/{2,3,4}</code> function for the -response’s body. The <code>gun:flush/1</code> function can be used to clear all +The <code>gun:await/2,3,4</code> function waits for a response to the given +request, and the <code>gun:await_body/2,3,4</code> function for the +response body. The <code>gun:flush/1</code> function can be used to clear all messages related to a request or a connection from the mailbox -of the process.</p></div> +of the calling process.</p></div> <div class="paragraph"><p>The function <code>gun:cancel/2</code> can be used to silence the response to a request previously sent if it is no longer needed. When using HTTP/1.1 there is no multiplexing so Gun will have to receive the response fully before any -other response can be received.</p></div> +other responses can be received.</p></div> <div class="paragraph"><p>Finally, Gun can upgrade an HTTP/1.1 connection to Websocket. -It provides the <code>gun:ws_upgrade/{2,3,4}</code> function for that -purpose. A <code>gun_ws_upgrade</code> message will be sent on success; +It provides the <code>gun:ws_upgrade/2,3,4</code> function for that +purpose. A <code>gun_upgrade</code> message will be sent on success; a <code>gun_response</code> message otherwise.</p></div> </div> </div> @@ -103,21 +105,22 @@ a <code>gun_response</code> message otherwise.</p></div> <div class="paragraph"><p>HTTP/2 is a binary protocol based on HTTP, compatible with the HTTP semantics, that reduces the complexity of parsing requests and responses, compresses the HTTP headers and -allows the server to push multiple responses to a single -request.</p></div> +allows the server to push additional resources along with +the normal response to the original request.</p></div> <div class="paragraph"><p>The HTTP/2 interface is very similar to HTTP/1.1, so this section instead focuses on the differences in the interface for the two protocols.</p></div> -<div class="paragraph"><p>Because a HTTP/2 server can push multiple responses to a -single request, Gun might send <code>gun_push</code> messages for -every push received. They can be ignored safely if they -are not needed.</p></div> +<div class="paragraph"><p>Gun will send <code>gun_push</code> messages for every push received. +They will always be sent before the <code>gun_response</code> message. +They can be ignored safely if they are not needed, or they +can be canceled.</p></div> <div class="paragraph"><p>The <code>gun:cancel/2</code> function will use the HTTP/2 stream cancellation mechanism which allows Gun to inform the server to stop sending a response for this particular request, saving resources.</p></div> -<div class="paragraph"><p>It is not possible to upgrade an HTTP/2 connection to Websocket -due to protocol limitations.</p></div> +<div class="paragraph"><p>It is not currently possible to upgrade an HTTP/2 connection +to Websocket. Support for this will be added in a future +release.</p></div> </div> </div> <div class="sect1"> @@ -277,6 +280,12 @@ cellspacing="0" cellpadding="4"> <td align="center" valign="top"><p class="table">no</p></td> </tr> <tr> +<td align="left" valign="top"><p class="table">gun_inform</p></td> +<td align="center" valign="top"><p class="table">yes</p></td> +<td align="center" valign="top"><p class="table">yes</p></td> +<td align="center" valign="top"><p class="table">no</p></td> +</tr> +<tr> <td align="left" valign="top"><p class="table">gun_response</p></td> <td align="center" valign="top"><p class="table">yes</p></td> <td align="center" valign="top"><p class="table">yes</p></td> @@ -289,7 +298,7 @@ cellspacing="0" cellpadding="4"> <td align="center" valign="top"><p class="table">no</p></td> </tr> <tr> -<td align="left" valign="top"><p class="table">gun_error (StreamRef)</p></td> +<td align="left" valign="top"><p class="table">gun_trailers</p></td> <td align="center" valign="top"><p class="table">yes</p></td> <td align="center" valign="top"><p class="table">yes</p></td> <td align="center" valign="top"><p class="table">no</p></td> @@ -301,7 +310,7 @@ cellspacing="0" cellpadding="4"> <td align="center" valign="top"><p class="table">yes</p></td> </tr> <tr> -<td align="left" valign="top"><p class="table">gun_ws_upgrade</p></td> +<td align="left" valign="top"><p class="table">gun_upgrade</p></td> <td align="center" valign="top"><p class="table">yes</p></td> <td align="center" valign="top"><p class="table">no</p></td> <td align="center" valign="top"><p class="table">no</p></td> |