htmx-extensions
htmx-extensions copied to clipboard
SSE Retries without Last-Event-ID Header
When the browser retries an SSE connection it sets a Last-Event-Id header that contains the event ID of the last event it received. But when the the htmx sse extension retries the connection it doesn't set that header.
For me this ends up duplicating a bunch of messages because, to the server, the re-connection is indistinguishable from a full page reload or a new tab being opened which needs the event history.
As far as I know it's impossible to set any headers on the request generated by constructing a new EventSource. Is there some other way to prevent randomly getting duplicate events without also possibly missing some events?