aboutsummaryrefslogblamecommitdiffstats
path: root/doc/src/manual/gun.open_unix.asciidoc
blob: 441bfa8d7b442b35fbef9979849ad126d11fb240 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                                 
                                                            


                        


                                                             
                    












































                                                                      
                                          
                             
= gun:open_unix(3)

== Name

gun:open_unix - Open a connection to the given Unix domain socket

== Description

[source,erlang]
----
open_unix(SocketPath, Opts) -> {ok, pid()} | {error, Reason}

SocketPath :: string()
Opts       :: gun:opts()
Reason     :: {options, OptName}
            | {options, {http | http2 | socks | ws, OptName}}
            | any()
OptName    :: atom()
----

Open a connection to the given Unix domain socket.

== Arguments

SocketPath::

Path to the Unix domain socket to connect to.

Opts::

Options for this connection.

== Return value

The pid of the newly created Gun process is returned.
Note that this does not indicate that the connection
has been successfully opened; the link:man:gun_up(3)[gun_up(3)]
message will be sent for that.

== Changelog

* *1.0*: Function introduced.

== Examples

.Connect to a server via a Unix domain socket
[source,erlang]
----
{ok, ConnPid} = gun:open_unix("/var/run/dbus/system_bus_socket", #{}).
----

.Connect to a server via a Unix domain socket with custom options
[source,erlang]
----
{ok, ConnPid} = gun:open_unix("/var/run/dbus/system_bus_socket",
    #{protocols => [http2]}).
----

== See also

link:man:gun(3)[gun(3)],
link:man:gun:open(3)[gun:open(3)],
link:man:gun:await_up(3)[gun:await_up(3)],
link:man:gun_socks_up(3)[gun_socks_up(3)],
link:man:gun_up(3)[gun_up(3)]