Replies: 1 comment
-
document.body.addEventListener('htmx:sseClose', function(e) {
document.body.removeAttribute('sse-connect');
});
document.body.addEventListener('htmx:sseError', function(e) {
document.body.removeAttribute('sse-connect');
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been exploring the htmx sse extension and appreciate the ease of use and functionality that it provides.
I am unsure how to cancel an event stream. Per https://web.dev/articles/eventsource-basics, it says "To cancel a stream from the server, respond with a non text/event-stream Content-Type or return an HTTP status other than 200 OK (e.g. 404 Not Found)."
When I do this, the stream stops, but then the event stream is re-initiated, potentially due to the Automatic Reconnection logic?
How can I avoid automatic reconnection in this case?
Beta Was this translation helpful? Give feedback.
All reactions