sse: Close connection before page switch #147
Draft
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.
Description
This PR may require changes before needing merge. All it does is unconditionally close the SSE connections before the page is about to be switched. The problem is that - on Chrome (but not Safari) if we do not do this, then the SSE connections are kept alive and for every page/route switch, there will be O(n) active SSE connections, which from time to time causes normal link clicks to hang (DevTools shows that request in
pending
mode) for sometime before the server responds (using Haskell servant here).Htmx version:
https://unpkg.com/[email protected]
Used extension(s) version(s):
sse
from masterCorresponding issue: bigskysoftware/htmx#2109
I'll leave this as draft just to indicate that a) it is not ready to be merged, b) provide a fork for other interested party to rely upon, and c) maybe inspire somebody else to finish it.
Testing
Checklist
npm run test
) and verified that it succeeded