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.

struct libtmux-go latest

NotificationStream

NotificationStream owns one observation-only control client attached to a session. It yields tmux notifications in wire order and must be closed. Acquisition requires tmux 3.7 before any control client is started.

Source and package
Qualified name
tmux.NotificationStream
Package
tmux
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/notification_stream.go
struct tmux.NotificationStream

Description#

A stream ends in one of three ways, and none can be resumed. A stream is one tmux client, so a new one is a new client: it starts at tmux's present, with no subscriptions armed, no pane held by PauseAfter, and none of what the old stream had queued or tmux sent in the gap. To recover, close the old stream, read whatever state matters from tmux directly, open another with Server.OpenNotifications or Session.OpenNotifications, and Subscribe again. ControlClient.Reconnect is not offered here because it would have to choose between dropping the subscriptions silently and replaying commands, which the package never does.

Members7#

  • Close method Close stops the notification stream. It is safe to call concurrently and more than once.
  • CloseContext method CloseContext starts idempotent stream shutdown and waits within ctx. The context bounds only the wait; a later call may resume waiting for shutdown.
  • ContinuePane method ContinuePane resumes pane output tmux held after this stream fell behind on it. tmux does not replay what it held, so read the pane to recover that span rather than waiting for it. Resuming a pane tmux never paused does nothing and reports nothing, because tmux answers neither.
  • Next method Next returns the next ordered control-mode notification. Concurrent calls are serialized: each notification goes to exactly one call, and a call waiting its turn returns when ctx ends.
  • Notifications method Notifications returns NotificationStream.Next as a range loop; reads from several iterators or direct calls are serialized. Malformed notifications yield their error and iteration continues; every other error ends the loop after being yielded.
  • Subscribe method Subscribe asks tmux to evaluate request's format and report it on this stream as a subscription-changed notification, read with ControlNotification.Subscription. tmux reports the value at its next evaluation, about a second later, and then each time it changes. Arming a name already armed replaces its format.
  • Unsubscribe method Unsubscribe stops the subscription armed under name. Stopping a name that was never armed does nothing and reports nothing, because tmux answers neither.

Guides#

Pages that discuss NotificationStream.

Esc

Type to search.

Reference previewOpen reference