← All posts

Streaming that never cuts out: heartbeats, watchdogs and [DONE]

Nov 20, 2026 · GrexLabs Engineering

Long generations die when an upstream stalls. GrexLabs defends with three layers:

Heartbeats

A SSE comment heartbeat is sent every 15 seconds so proxies and browsers never idle-timeout a healthy stream.

Stall watchdog

If no bytes arrive for 60 seconds, the attempt is abandoned and the router fails over to the next healthy provider.

Clean termination

Streams always close with data: [DONE] so OpenAI-compatible clients finish their parse loop without hanging.

See the docs for stream: true examples.