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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
= gun:await_up(3)
== Name
gun:await_up - Wait for the connection to be up
== Description
[source,erlang]
----
await_up(ConnPid)
-> await_up(ConnPid, 5000, MonitorRef)
await_up(ConnPid, MonitorRef)
-> await_up(ConnPid, 5000, MonitorRef)
await_up(ConnPid, Timeout)
-> await_up(ConnPid, Timeout, MonitorRef)
await_up(ConnPid, Timeout, MonitorRef)
-> {ok, Protocol} | {error, Reason}
ConnPid :: pid()
MonitorRef :: reference()
Timeout :: timeout()
Protocol :: http | http2 | socks
Reason :: {down, any()} | timeout
----
Wait for the connection to be up.
== Arguments
ConnPid::
The pid of the Gun connection process.
Timeout::
How long to wait for, in milliseconds.
MonitorRef::
Monitor for the Gun connection process.
+
A monitor is automatically created for the duration of this
call when one is not provided.
== Return value
The protocol selected for this connection. It can be used
to determine the capabilities of the server. Error tuples
may also be returned when a timeout or an error occur.
== Changelog
* *2.0*: The error tuple type now includes the type of error.
* *1.0*: Function introduced.
== Examples
.Wait for the connection to be up
[source,erlang]
----
{ok, ConnPid} = gun:open("example.org", 443).
{ok, _} = gun:await_up(ConnPid).
----
== See also
link:man:gun(3)[gun(3)],
link:man:gun:open(3)[gun:open(3)],
link:man:gun:open_unix(3)[gun:open_unix(3)],
link:man:gun_socks_up(3)[gun_socks_up(3)],
link:man:gun_up(3)[gun_up(3)]
|