# io.github.libtmux.control.ControlClient.ControlClient

- **Module:** io.github.libtmux.control.ControlClient
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-java/blob/c3517519ee799428a809ce6deb1708c8be289cd1/libtmux/src/main/java/io/github/libtmux/control/ControlClient.java#L43
- **Page:** https://libtmux.org/reference/java/io-github-libtmux-control-controlclient-controlclient/

A tmux client that stays attached and answers one command at a time.

<p>This is what a semicolon group cannot be. tmux discards a group after its first failure, so a
client has to infer which command failed; here each request is independent and each reply carries
the request number that produced it, so a failure discards nothing behind it and attribution is
tmux's own.

<p>Replies arrive in request order, so the writer sends one request at a time and matches its
reply by position. A deadline before the writer picks a request writes nothing; a deadline after
that point ends the client because the next reply could no longer be attributed safely.

<p>The reader and writer are platform threads. A library does not own the virtual-thread
scheduler, and either one unable to run stops the client from making progress. The reader only
resolves replies and fills bounded subscription buffers; subscriber code runs on the thread that
pulls a value.

## Members

- `attach` (method) — Attaches a control client to an existing session.
- `send` (method) — Runs one command and waits for its reply.
- `isAlive` (method) — Whether the client is still running.
- `subscribeOutput` (method) — Subscribes to terminal output tmux pushes.
- `subscribeEvents` (method) — Subscribes to state changes tmux volunteers.
- `watch` (method) — Asks tmux to report a format whenever its value changes.
- `unwatch` (method) — Stops a watch. tmux reads a name with no colon in it as one to remove.
- `close` (method) — Ends the client, rejecting queued requests and resolving picked requests as uncertain.
- `line` (method) — tmux parses a control-mode request as one line, so an argument has to survive its lexer. Single quotes preserve everything except a single quote, which is closed, escaped and reopened.
- `unescape` (method) — tmux writes a byte it cannot print as a three-digit octal escape.
