SSE stream silently drops events when a client lags behind the broadcast bus #77

Closed
opened 2026-10-01 16:15:31 +08:00 by Breadway · 1 comment
Owner

How found: reading crates/breadboard-server/src/http.rs (events handler) while debugging the web client's live indicator. Not triggered.

Confidence: medium-high (the code path is clear; it needs a slow client or a burst larger than the broadcast channel's capacity, e.g. a reconcile touching many issues).

Explanation: the handler maps BroadcastStream items with Err(_) => None. A RecvError::Lagged(n) means the client missed n events, but the stream just carries on, so the client never learns it is out of date and doesn't reload. The web client's resync (from BB-82) only runs on reconnect, which never happens here.

Fix idea: on Lagged, emit a resync event (or close the stream so EventSource reconnects and the client reloads). Document the event in Documentation.md if a new variant is added.

**How found:** reading `crates/breadboard-server/src/http.rs` (`events` handler) while debugging the web client's live indicator. Not triggered. **Confidence:** medium-high (the code path is clear; it needs a slow client or a burst larger than the broadcast channel's capacity, e.g. a reconcile touching many issues). **Explanation:** the handler maps `BroadcastStream` items with `Err(_) => None`. A `RecvError::Lagged(n)` means the client missed n events, but the stream just carries on, so the client never learns it is out of date and doesn't reload. The web client's resync (from BB-82) only runs on reconnect, which never happens here. **Fix idea:** on `Lagged`, emit a `resync` event (or close the stream so EventSource reconnects and the client reloads). Document the event in Documentation.md if a new variant is added.
Author
Owner

Implemented on fix/bb-90-sse-lag, PR #79. When the SSE receiver lags, the response now ends so EventSource reconnects and clients can reload the board snapshot. Added a regression test and documented the reconnect contract. Workspace tests, Clippy, and check-docs pass.

Implemented on `fix/bb-90-sse-lag`, PR https://git.breadway.dev/Breadway/breadboard/pulls/79. When the SSE receiver lags, the response now ends so EventSource reconnects and clients can reload the board snapshot. Added a regression test and documented the reconnect contract. Workspace tests, Clippy, and check-docs pass.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/breadboard#77
No description provided.