From 5e05fe8e7877ffd6bc473b77b8ca0a12ad26bd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 14 Mar 2024 16:23:56 +0100 Subject: Cowboy 2.12, Cowlib 2.13, Gun 2.1 --- docs/en/gun/2.1/manual/gun_push/index.html | 227 +++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 docs/en/gun/2.1/manual/gun_push/index.html (limited to 'docs/en/gun/2.1/manual/gun_push') diff --git a/docs/en/gun/2.1/manual/gun_push/index.html b/docs/en/gun/2.1/manual/gun_push/index.html new file mode 100644 index 00000000..fb9e5ff5 --- /dev/null +++ b/docs/en/gun/2.1/manual/gun_push/index.html @@ -0,0 +1,227 @@ + + + + + + + + + + Nine Nines: gun_push(3) + + + + + + + + + + + + + + + +
+
+
+
+ +

gun_push(3)

+ +

Name

+

gun_push - Server-initiated push

+

Description

+
+
{gun_push, ConnPid, StreamRef, NewStreamRef, Method, URI, Headers}
+
+ConnPid      :: pid()
+StreamRef    :: gun:stream_ref()
+NewStreamRef :: gun:stream_ref()
+Method       :: binary()
+URI          :: binary()
+Headers      :: [{binary(), binary()}]
+
+

Server-initiated push.

+

This message informs the relevant process that the server is pushing a resource related to the effective target URI of the original request.

+

A server-initiated push message always precedes the response to the original request.

+

This message will not be sent when using the HTTP/1.1 protocol because it lacks the concept of server-initiated push.

+

Elements

+
ConnPid
+

The pid of the Gun connection process.

+
+
StreamRef
+

Identifier of the stream for the original request.

+
+
NewStreamRef
+

Identifier of the stream being pushed.

+
+
Method
+

Method of the equivalent HTTP request.

+
+
URI
+

URI of the resource being pushed.

+
+
Headers
+

Headers of the equivalent HTTP request.

+
+
+

Changelog

+
  • 1.0: Message introduced. +
  • +
+

Examples

+
Receive a gun_push message in a gen_server
+
+
handle_info({gun_push, ConnPid, _StreamRef,
+             _NewStreamRef, _Method, _URI, _Headers},
+            State=#state{conn_pid=ConnPid}) ->
+    %% Do something.
+    {noreply, State}.
+
+
Cancel an unwanted push
+
+
handle_info({gun_push, ConnPid, _StreamRef,
+             NewStreamRef, _Method, _URI, _Headers},
+            State=#state{conn_pid=ConnPid}) ->
+    gun:cancel(ConnPid, NewStreamRef),
+    {noreply, State}.
+
+

See also

+

gun(3), gun:get(3), gun:cancel(3), gun_response(3)

+ + + + + + +
+ +
+ + +

+ Gun + 2.1 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +

Like my work? Donate!

+

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:

+
+ + + + + + + + + +

Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.

+ + + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3