# tmux_stream:subscribe/3

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/38478dff54579a4f408005d0265031abdf3a880a/apps/libtmux_erlang/src/tmux_stream.erl#L57
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_stream-subscribe-3/

```
subscribe(Server, Session, Options)
-spec subscribe(tmux_server:t(),
                tmux_model:session(),
                options()) ->
                   {ok, subscription()} | {error, map()}.
```

Start a dedicated client on an owned or borrowed server and subscribe this process. Pass a session captured on that endpoint. Attaching skips the session environment update and ignores the client's size. Native hooks still run. The client retires when tmux reports a different session. The returned subscription includes its initial credit. Start effects after this call returns to observe their output. A startup error can return a control handle for `tmux_control:close/1` when native retirement needs another attempt.

## Parameters

- `Server` (`tmux_server:t()`)
- `Session` (`tmux_model:session()`)
- `Options` (`options()`)

## Guides

Pages that discuss `subscribe/3`.

### Concepts

- [Architecture decisions](/en/erlang/latest/concepts/architecture/)

### Topics

- [Control connections](/en/erlang/latest/topics/control/)
