# Libtmux_unix.Client.subscribe

- **Module:** Libtmux_unix
- **Package:** libtmux-unix
- **Language:** OCaml
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/unix/libtmux_unix.mli#L213
- **Public owner:** Libtmux_unix
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client-subscribe/

```
val subscribe :
  ?session:Libtmux.Session.target ->
  ?capacity_bytes:int ->
  ?capacity_events:int ->
  t -> Libtmux.Pane.t -> (Subscription.t, Libtmux.Error.t) result
```

Acquire verified coverage of the pane's observed session/window. Choose the least session ID unless explicitly supplied. Reuse one lane per session. Defaults: 1 MiB and 1024 queued events per subscriber; at most 16 subscribers and eight client lanes including commands. Reserve payload against the shared 32 MiB budget before admission.

Queue capacities remain reserved while empty. Captures and reads need additional scratch space; their admission can return [`Libtmux.Error.Capacity`](/en/ocaml/latest/reference/libtmux-error-t-capacity/) below the subscriber-count limit. See the [shared capacity guide](https://github.com/libtmux/libtmux-ocaml/blob/master/docs/streaming.md#plan-shared-capacity) for the combined reservations and process slots.

Data starts after admission's marker. Layout/membership changes end continuity conservatively. Overflow emits Gap then End, without blocking another subscriber. Blocking delivery advances during Subscription.next. There is no snapshot/history barrier or automatic recovery.

## Parameters

- `session?` (`Libtmux.Session.target`)
- `capacity_bytes?` (`int`)
- `capacity_events?` (`int`)
- `arg1` (`t`)
- `arg2` (`Libtmux.Pane.t`)

## tmux command

The tmux commands behind `subscribe`.

- [`display-message`](/en/tmux/latest/manual/display-message/)
- [`refresh-client`](/en/tmux/latest/manual/refresh-client/) (when opening a new stream lane)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_display_message_entry`](/en/tmux/latest/reference/c-variable-cmd_display_message_entry/) (attribute)
- [`cmd_display_message_exec`](/en/tmux/latest/reference/c-function-cmd-display-message-c-cmd_display_message_exec/) (function)
- [`cmd_refresh_client_entry`](/en/tmux/latest/reference/c-variable-cmd_refresh_client_entry/) (attribute)
- [`cmd_refresh_client_exec`](/en/tmux/latest/reference/c-function-cmd-refresh-client-c-cmd_refresh_client_exec/) (function)
