Streaming that never cuts out: heartbeats, watchdogs and [DONE]
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.