# io.github.libtmux.control.EventSubscription.poll

- **Module:** io.github.libtmux.control
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-java/blob/f56392b5d9bc7f1f9c1631842333fb90f3d82d40/libtmux/src/main/java/io/github/libtmux/control/EventSubscription.java#L189
- **Page:** https://libtmux.org/en/java/latest/reference/io-github-libtmux-control-eventsubscription-eventsubscription-poll/

```
io.github.libtmux.control.EventSubscription.poll() -> Optional<Delivery<T>>
```

Returns the next step if one is waiting, without blocking.

## Returns

the next gap or event, or empty when none is buffered; after the subscription has ended, empty once what it held is read

## Raises

- [`IllegalStateException`](https://docs.oracle.com/en/java/javase/21/docs/api/java/lang/IllegalStateException.html): if another read is in progress, or a stream or publisher owns this subscription
