# `Imp.ACP.Local`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/acp/local.ex#L1)

Local ACP attachment to a long-running application over a private UNIX socket.

Each accepted connection gets its own ordinary `Imp.ACP` adapter. A host
application supplies a program factory that attaches to its own runtime;
closing the connection closes the adapter, not that independently owned runtime.
`relay/2` exposes this socket as standard ACP stdio to an ordinary client.

Existing socket paths are always refused, including stale paths. Remove a
stale socket only after independently establishing that its owner is gone.
The parent directory must be private (0700); an absent directory is created.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `relay`

Relays bounded ACP frames between standard streams and a local service socket.

## Options

* `:max_frame_bytes` (`t:pos_integer/0`) - Largest ACP frame read or written, in bytes. The default value is `1048576`.

# `start_link`

Listens on a private UNIX socket and gives each connection its own agent.

The agent options are validated here, before anything listens, and an
option this function does not know raises `ArgumentError`.

## Options

* `:socket_path` (`t:String.t/0`) - Required. Where to listen. The path must not exist; its directory must be private.

* `:max_frame_bytes` (`t:pos_integer/0`) - Largest ACP frame read or written, in bytes. The default value is `1048576`.

* `:agent_options` - Options for the `Imp.ACP` agent each connection gets, as `Imp.ACP.start_link/1` takes them, less the transport and frame limit this module sets: `:name`, `:transport`, `:transport_mod`, `:transport_options`, `:max_frame_bytes`. The default value is `[]`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
