# `Pixir.Provider.StreamIdle`
[🔗](https://github.com/Ranvier-Technologies/pixir/blob/main/lib/pixir/provider/stream_idle.ex#L1)

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`.

# `run`

```elixir
@spec run(((-&gt; :ok) -&gt; 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).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
