Document SSE pauseOnBackground behavior and Last-Event-ID resumption#3681
Open
scriptogre wants to merge 1 commit intobigskysoftware:fourfrom
Open
Document SSE pauseOnBackground behavior and Last-Event-ID resumption#3681scriptogre wants to merge 1 commit intobigskysoftware:fourfrom
scriptogre wants to merge 1 commit intobigskysoftware:fourfrom
Conversation
Add a "Background Tab Behavior" section to the SSE extension docs explaining that messages are lost while the tab is backgrounded and how servers can use id: fields and Last-Event-ID to replay them. Includes a FastAPI + sse-starlette example. Add a test verifying that reconnection after a background pause sends the Last-Event-ID header and that the server can replay missed messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
id:fields andLast-Event-IDto replay themLast-Event-IDheader and that the server can replay missed messagesContext
pauseOnBackground(enabled by default forhx-sse:connect) disconnects the stream when the tab is hidden and reconnects when visible. This exists because iOS Safari silently kills SSE connections when backgrounded without firing error events. The docs didn't explain that messages during the gap are lost or howLast-Event-IDcan recover them.Test plan