# libtmux.control:next-event

- **Package:** libtmux/control
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/control.lisp#L316
- **Public owner:** libtmux.control
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-control-next-event/

```
(next-event connection &key (timeout 30))
```

Wait for an owned event/:READY or NIL/:TIMEOUT on this connection.
TIMEOUT is nonnegative real seconds or NIL; zero polls. :OUTPUT has :PANE,
:AGE, :EXTENDED-P and :DATA octets, preserving invalid UTF-8. :NOTIFICATION
contains a raw line without LF in :DATA, preserving unknown labels and bytes.
Native %exit is a notification; transport end is reported independently.
Unsolicited :REPLY also has :FAILED-P.
:GAP reports :EVENTS and :BYTES dropped from the bounded queue. An oversized
new event reports loss without discarding retained smaller events.
Local loss does not pause tmux. Native pause/continue notices remain raw
notifications and are distinct from local :GAP delivery.
:END follows retained events, with :REASON, :EXIT-CODE, :DIAGNOSTICS bytes,
:WIRE-TAIL bytes and :CAUSE. After end, repeated reads return end immediately.
Causes retain condition identity. No application callback executes in the reader.

See also: `libtmux.control:await-request`, `libtmux.control:connection-failure`, `libtmux.control:open-connection`.

## Parameters

- `connection`
- `timeout?`

## Guides

Pages that discuss `next-event`.

- [Getting started](/en/lisp/latest/guides/getting-started/)
