# LibTmux.Server.withControl

- **Package:** libtmux-haskell
- **Language:** Haskell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-haskell/blob/72edb54317bf619c6dc54bff311844f062f8984c/src/LibTmux/Server.hs#L344
- **Page:** https://libtmux.org/en/haskell/latest/reference/libtmux-server-v-withcontrol/

```haskell
withControl
  :: Server
  -> SessionRef
  -> ControlOptions
  -> (Control -> IO a)
  -> IO a
```

Signature types: [`Server`](/en/haskell/latest/reference/libtmux-server-t-server/), [`SessionRef`](/en/haskell/latest/reference/libtmux-snapshot-t-sessionref/), [`ControlOptions`](/en/haskell/latest/reference/libtmux-control-t-controloptions/), [`Control`](/en/haskell/latest/reference/libtmux-control-t-control/), [`IO`](https://hackage.haskell.org/package/base-4.22.0.0/docs/Prelude.html#t:IO).

Observe a session from this Server through an attached control client.
 Start the callback after tmux acknowledges the selected session. Read
 bounded notifications through [`LibTmux.Control`](/en/haskell/latest/reference/libtmux-control/) and make changes through
 the Server operations. Closing the callback retires its own client.

## Referenced declarations

- [`LibTmux.Control.Control`](/en/haskell/latest/reference/libtmux-control-t-control/) (data type)
- [`LibTmux.Control.ControlOptions`](/en/haskell/latest/reference/libtmux-control-t-controloptions/) (data type)
- [`LibTmux.Server.Server`](/en/haskell/latest/reference/libtmux-server-t-server/) (data type)
- [`LibTmux.Snapshot.SessionRef`](/en/haskell/latest/reference/libtmux-snapshot-t-sessionref/) (data type)

## tmux command

The tmux commands behind `withControl`.

- [`attach-session`](/en/tmux/latest/manual/attach-session/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_attach_session_entry`](/en/tmux/latest/reference/c-variable-cmd_attach_session_entry/) (attribute)
- [`cmd_attach_session_exec`](/en/tmux/latest/reference/c-function-cmd-attach-session-c-cmd_attach_session_exec/) (function)

## Guides

Pages that discuss `withControl`.

### Core

- [tmux client library for Haskell](/en/haskell/latest/core/)

### Guides

- [Observe control notifications](/en/haskell/latest/guides/control/)
- [Implementation status](/en/haskell/latest/guides/status/)
