Pixir.Provider.StreamIdle (pixir v0.1.0)

Copy Markdown View Source

Per-chunk idle watchdog for Provider streams.

A hung SSE or WebSocket stream is cut when no activity arrives within stream_idle_timeout_ms. HTTP/SSE transports run behind a spawned runner so the caller can enforce the window; WebSocket clients also reset the deadline on every received frame (including control frames) via :stream_activity.

Summary

Functions

Run stream_fn behind a per-chunk idle watchdog.

Functions

run(stream_fn, opts, transport_label)

@spec run(((-> :ok) -> term()), keyword(), String.t()) :: term()

Run stream_fn behind a per-chunk idle watchdog.

stream_fn receives an activity callback that transports must invoke whenever they receive a chunk/frame (HTTP via the wrapped reducer; WebSocket via :stream_activity in opts).