{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()}]
gun_push - Server-initiated push
{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.
The pid of the Gun connection process.
Identifier of the stream for the original request.
Identifier of the stream being pushed.
Method of the equivalent HTTP request.
URI of the resource being pushed.
Headers of the equivalent HTTP request.
handle_info({gun_push, ConnPid, _StreamRef, _NewStreamRef, _Method, _URI, _Headers}, State=#state{conn_pid=ConnPid}) -> %% Do something. {noreply, State}.
handle_info({gun_push, ConnPid, _StreamRef, NewStreamRef, _Method, _URI, _Headers}, State=#state{conn_pid=ConnPid}) -> gun:cancel(ConnPid, NewStreamRef), {noreply, State}.
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.