aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/gun_notify.asciidoc
blob: 90daee85421f93f202434f07d7a8c24d59bfaacd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
= gun_notify(3)

== Name

gun_notify - Optional event notification

== Description

[source,erlang]
----
{gun_notify, ConnPid, settings_changed, Settings}

ConnPid  :: pid()
Settings :: map()
----

Optional event notification.

Only two event notifications currently exist:

* `settings_changed` informs the user that the server has
  modified its connection settings.

* `ping_ack` informs the user that acknowledgement for a
  user ping was received.

== Elements

ConnPid::

The pid of the Gun connection process.

Event::

Identifier for the event. Currently can only be
`settings_changed` or `ping_ack`.

Data::

Data for the event. Currently can only be the
new connection settings, or the ping reference.

== Changelog

* *2.2*: Message introduced.

== Examples

.Receive a gun_notify message in a gen_server
[source,erlang]
----
handle_info({gun_notify, ConnPid, settings_changed, Settings},
            State=#state{conn_pid=ConnPid}) ->
    %% Do something.
    {noreply, State}.
----

== See also

link:man:gun(3)[gun(3)],
link:man:gun:ping(3)[gun:ping(3)]