# LibTmux::Control::Connection

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Raku
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-raku/blob/e76160bcce6e03976d49424da15b7c31afb2c68e/lib/LibTmux/Control/Connection.rakumod#L5
- **Page:** https://libtmux.org/en/raku/latest/reference/libtmux-control-connection/

# Owned control connection

Connection connects to an exact session on an observed daemon. Startup verifies
the daemon again over the persistent connection. The ignore-size client flag
avoids changing pane dimensions. New layouts are negotiated when supported;
older profiles retain their native control layout representation.

Commands are serialized through one bounded queue. A separate unpredictable
FORMAT barrier correlates every response, including nested commands and jobs
which print after their end guard. A barrier means the tmux command queue reached
that point; background jobs and external effects still need domain-specific
completion evidence. Raw command output has the framing limitations described
by :obj:`LibTmux::Control <LibTmux::Control>`. Declared projections avoid arbitrary output delimiters.

Each request owns a deadline from admission. Cancelling an unsent request leaves
the connection usable. Timeout or cancellation after dispatch closes the whole
connection because later response ownership is uncertain. Effects already sent
remain indeterminate. Closing stops the client, not the daemon or launched jobs.

An event Supply is shared, live and bounded per subscriber. Reconnect requires a
new Connection and explicit snapshot acquisition; old requests and observations
never migrate automatically. Every connection has a distinct epoch.

## Members

### Other members

- [`Acknowledgement`](/en/raku/latest/reference/libtmux-control-connection-acknowledgement/) (class): Ordered command records observed before a separate queue barrier completed.
- [`cleanup-timeout-ms`](/en/raku/latest/reference/libtmux-control-connection-cleanup-timeout-ms/) (property): Separate termination and reaping budget in milliseconds.
- [`clone`](/en/raku/latest/reference/libtmux-control-connection-clone/) (method): Refuse cloning of a process and its pending request state.
- [`close`](/en/raku/latest/reference/libtmux-control-connection-close/) (method): Stop admission, settle every request and reap only this connection's client.
- [`close-async`](/en/raku/latest/reference/libtmux-control-connection-close-async/) (method): Share one bounded shutdown which settles pending work and reaps only this client.
- [`closed`](/en/raku/latest/reference/libtmux-control-connection-closed/) (method): Shared completion Promise for connection shutdown; callers cannot resolve it.
- [`connect`](/en/raku/latest/reference/libtmux-control-connection-connect/) (method): Observe, attach and verify a persistent connection to an exact session ID.
- [`connect-async`](/en/raku/latest/reference/libtmux-control-connection-connect-async/) (method): Resolve to a verified connection or reject after bounded startup cleanup.
- [`endpoint`](/en/raku/latest/reference/libtmux-control-connection-endpoint/) (property): Captured connection settings; retaining them owns no process.
- [`epoch`](/en/raku/latest/reference/libtmux-control-connection-epoch/) (property): Unique connection identity; reconnecting always creates a new epoch.
- [`events`](/en/raku/latest/reference/libtmux-control-connection-events/) (method): All taps share this process; each receives independently bounded live delivery.
- [`execute`](/en/raku/latest/reference/libtmux-control-connection-execute/) (method): Execute one raw command, waiting for a separate queue barrier; no rollback is implied.
- [`execute-async`](/en/raku/latest/reference/libtmux-control-connection-execute-async/) (method): Queue one command and resolve its ordered acknowledgement; cancellation may close the connection.
- [`explain`](/en/raku/latest/reference/libtmux-control-connection-explain/) (method): Explain a query against this connection's immutable negotiated capabilities, without I/O.
- [`explain-panes`](/en/raku/latest/reference/libtmux-control-connection-explain-panes/) (method): Explain pane restrictions and local residual work.
- [`failure`](/en/raku/latest/reference/libtmux-control-connection-failure/) (method): Terminal connection error, or an undefined Exception after normal close.
- [`max-command-bytes`](/en/raku/latest/reference/libtmux-control-connection-max-command-bytes/) (property): Maximum encoded command size in bytes, including tmux quoting.
- [`max-output-bytes`](/en/raku/latest/reference/libtmux-control-connection-max-output-bytes/) (property): Per-response output-byte limit; retained stderr has the same separate bound.
- [`max-pending`](/en/raku/latest/reference/libtmux-control-connection-max-pending/) (property): Maximum admitted requests, including the active request and queued cancellations.
- [`new`](/en/raku/latest/reference/libtmux-control-connection-new/) (method): Refuse unstarted owners; construct a live owner through connect.
- [`observation`](/en/raku/latest/reference/libtmux-control-connection-observation/) (method): Return the immutable identity and negotiated capabilities established at connection time.
- [`observe`](/en/raku/latest/reference/libtmux-control-connection-observe/) (method): Verify the connected daemon through a queue barrier without acquiring a graph.
- [`observe-async`](/en/raku/latest/reference/libtmux-control-connection-observe-async/) (method): Verify daemon identity through a queued barrier and resolve the captured observation.
- [`pid`](/en/raku/latest/reference/libtmux-control-connection-pid/) (method): Owned control-client PID, or undefined before successful process creation.
- [`query`](/en/raku/latest/reference/libtmux-control-connection-query/) (method): Acquire a selection through this connection; retained observations keep no live owner.
- [`query-async`](/en/raku/latest/reference/libtmux-control-connection-query-async/) (method): Copy and validate query data before scheduling acquisition and residual evaluation.
- [`query-panes`](/en/raku/latest/reference/libtmux-control-connection-query-panes/) (method): Acquire pane observations with explicit source filtering.
- [`read`](/en/raku/latest/reference/libtmux-control-connection-read/) (method): Read a declared projection through the connection's negotiated codec profile.
- [`reaped`](/en/raku/latest/reference/libtmux-control-connection-reaped/) (method): Whether the owned control client has exited and been joined.
- [`session-id`](/en/raku/latest/reference/libtmux-control-connection-session-id/) (property): Session used for the initial attach; explicit client switching can later change it.
- [`snapshot`](/en/raku/latest/reference/libtmux-control-connection-snapshot/) (method): Acquire a fresh graph through this connection; retained views keep no connection alive.
- [`snapshot-async`](/en/raku/latest/reference/libtmux-control-connection-snapshot-async/) (method): Resolve a fresh graph acquired within one deadline, with explicit cancellation.
- [`timeout-ms`](/en/raku/latest/reference/libtmux-control-connection-timeout-ms/) (property): Default request deadline budget in milliseconds from admission.
- [`validate-command`](/en/raku/latest/reference/libtmux-control-connection-validate-command/) (method): Validate an encoded command against this connection without I/O or queue admission.
