Skip to main content
Streaming methods on client.stream() return EventStream<T> (Iterable<T> and AutoCloseable). Use try (...) so the underlying HTTP connection closes when you exit the loop.

Filtered and sampled streams

Keep-alive and idle timeout

The X API sends a blank-line heartbeat about every 20 seconds. Set idleTimeout (e.g., Duration.ofSeconds(60)) and reconnectOnClose(true) on StreamConfig to recover silently stalled or closed connections, and onKeepAlive to observe heartbeats:

Managing rules

See Build a Rule for rule syntax and operators.