# io.github.libtmux.scaladsl.cats.Observation

- **Module:** io.github.libtmux.scaladsl.cats
- **Package:** io.github.libtmux:libtmux-scala_3
- **Language:** Scala
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-java/blob/f56392b5d9bc7f1f9c1631842333fb90f3d82d40/libtmux-scala-cats/src/main/scala/io/github/libtmux/scaladsl/cats/Observation.scala#L26
- **Page:** https://libtmux.org/en/scala/latest/reference/io-github-libtmux-scaladsl-cats-observation/

```
final class Observation[F[_], A]

object Observation
```

Pulls a bounded Java subscription with one active stream consumer. A full buffer yields a `Delivery.Gap` in this stream before the events that remain. FS2 demand does not provide tmux backpressure. A subscription does not reconnect: attach again and read a snapshot.

The stream itself suspends the *fiber*, not a platform thread, while idle:
[[io.github.libtmux.control.EventSubscription EventSubscription]] is already
single-consumer by construction at the Java layer, with a non-blocking
[[io.github.libtmux.control.EventSubscription#poll poll]] plus a one-shot
[[io.github.libtmux.control.EventSubscription#onReady onReady]] wakeup. Each
wait polls first — if something is already buffered, nothing suspends at all
— and only then arms `onReady`, disarming it with
[[io.github.libtmux.control.EventSubscription#clearReady clearReady]] if the
fiber is cancelled first. No `ExecutionContext` sized for blocking stream
reads is needed, because no read here ever blocks a thread.

## Members

### Common operations

- `value` (method): The value inside an event delivery, and none for a gap.
- `kept` (method): The event a strict reader kept. A gap fails the read.
- `UnknownCause` (class): Java ended the subscription without exposing the reason.

### Other members

- `droppedCount` (method): The cumulative overflow count. A `Delivery.Gap` in [[stream]] says where it sits.
- `isClosed` (method): Reports subscription closure, including after resource finalization.
- `stream` (method): Reads on `F`'s own fiber scheduler. Cancelling the stream releases its consumer slot and disarms any pending wakeup; releasing the observation discards its buffered events. Deliberate closure ends the stream. A client that ended the subscription fails it with that cause.
