pub fn keep_alive<S>(
stream: S,
interval: Duration,
) -> impl Stream<Item = SseEvent>Expand description
Inject periodic comment frames (:keepalive\n\n) into an SSE stream.
Many HTTP proxies and load balancers close idle connections after 30-60s.
This helper interleaves the original events with synthetic keep-alive
comments emitted at interval. Comments are ignored by clients per the
SSE spec.