bigskysoftware / bigskysoftware/htmx

HTMX 4 hx-sse:connect gets stuck while trying to reconnect when server is down

Open
#4,072 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

I'm using HTMX 4.0.0 and hx-sse, I'm testing the "persistent connections".

The reconnect works. But only if the backend server is turned on. If I shut down the back-end server, the hx-sse tries to reconnect and gets stuck in a pending state. I started the back-end server, but the hx-sse did nothing. Is there a timeout option to cancel the request and try again...? I suspect that it gets stuck because there is no timeout on creating a connection.

Tried Firefox and Chromium. Backend server was on my local computer.

I did everything per documentation, also tried configuration settings.

```html


test


```

Contributor guide

Open the contributing guide

Research direction

Start with the hx-sse extension's reconnect handling and reproduce the issue using the provided HTML with htmx 4.0.0, stopping and restarting the local backend serving /events. Trace why the connection remains pending, then verify that reconnecting resumes after the server returns and that existing reconnect settings still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.