Christian Tanul d99095eb3c
Fix iOS Safari SSE disconnect on background (#3634) (#3640)
* Close SSE stream on visibility change to fix iOS Safari background disconnect (#3634)

iOS Safari silently kills TCP connections when the app is backgrounded,
leaving SSE streams dead with no error event. The new `closeOnHide`
config option proactively cancels the stream reader when the page
becomes hidden and reconnects when visible again (requires
`reconnect: true`).

Also renames `pauseInBackground` to `closeOnHide` across source, docs,
types, and tests to reflect the new disconnect/reconnect behavior
(previously it only paused processing).

* Improve SSE closeOnHide with reconnectRequested flag and cancellable backoff

- Create reader outside __parseSSE and pass as argument
- Add reconnectRequested flag so visibility reconnects skip backoff delay
- Symmetric visibility handler: cancel on hidden, reconnect on visible
- Cancellable backoff delay via delayCanceller so tab return is instant
2026-01-29 13:15:13 -07:00
..