Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-ts latest

Server.connect

Bind this server to one control-mode connection and return it.

Source and package
Qualified name
Server.connect
Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts

Description#

The returned server has the same API and shares one control connection for events and daemon-lifetime tracking. Commands use ordinary tmux processes: control mode cannot frame arbitrary command output truthfully when aliases and waiting commands are allowed. The connection has the attached-client lifecycle described by watch() until it closes.

Each snapshot acquisition remains one atomic tmux invocation containing its daemon identity read and all four listings. The first connected snapshot also follows the observer authentication and version probes.

Examples#

await using live = await server.connect();
for await (const event of live.subscribe()) {
if (event.kind === "window-add") console.log((await live.snapshot()).windows.count());
}
Parameters

Guides#

Pages that discuss connect.

Esc

Type to search.

Reference previewOpen reference