open(Host, Port) -> open(Host, Port, #{}) open(Host, Port, Opts) -> {ok, pid()} | {error, any()} Host :: inet:hostname() | inet:ip_address() Port :: inet:port_number() Opts :: gun:opts()
gun:open - Open a connection to the given host and port
open(Host, Port) -> open(Host, Port, #{}) open(Host, Port, Opts) -> {ok, pid()} | {error, any()} Host :: inet:hostname() | inet:ip_address() Port :: inet:port_number() Opts :: gun:opts()
Open a connection to the given host and port.
Host or IP address to connect to.
Port to connect to.
Options for this connection.
The pid of the newly created Gun process is returned. Note that this does not indicate that the connection has been successfully opened; the gun_up(3) message will be sent for that.
{ok, ConnPid} = gun:open("example.org", 443).
{ok, ConnPid} = gun:open("example.org", 443, #{protocols => [http2]}).
{ok, ConnPid} = gun:open({127,0,0,1}, 443).