bigskysoftware / bigskysoftware/htmx

Removing DOM element using SSE does not close the SSE connection

Open
#2,510 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

In the following example, I'm trying to delete `#foo` so that the SSE connection will close.

```html




```

If I delete the div in developer tools (Chromium 121.0.6167.184) or using `document.getElementById("panel").innerHTML=''`, the SSE connection stays open and never seems to close.

I'm using htmx 1.9.12.

-------

What I'm actually trying to do is replace `#foo` with another SSE connection. But since browsers are limited to ~6 open connections at a time, I'm trying to close the existing connection before replacing it, so something like this:

```html

```

In this case the contents of `#panel` are cleared, but the browser developer tools show that the SSE connection is still open. This sometimes prevents the GET request to `/bar` if there are too many existing open connections, since the SSE connection hasn't closed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.