bigskysoftware / bigskysoftware/htmx-extensions

Feature Request: Allow SSE extension to use a user-defined EventSource object

Open
#143 7 comments 0 reactions 0 assignees View on GitHub
documentation enhancement help wanted
Dominant language
JavaScript
Stars
284
Forks
88
PR merge metrics
No merged PRs in 30d

Description

This will allow more control over the behavior of the SSE connection. For instance, I want to implement the fix for this [firefox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=833462) where I need to have access to the `EventSource` object for this to be implemented. This will also fix several issues:

- https://github.com/bigskysoftware/htmx-extensions/issues/132
- https://github.com/bigskysoftware/htmx-extensions/issues/27

Another advantage is to be able to add event listeners outside of `htmx` context.

Also, the number of connections is limited to only 6 when not used in `HTTP2`, so it would be beneficial to reused an existing connection across multiple independent elements.

> Warning: When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6). The issue has been marked as "Won't fix" in [Chrome](https://crbug.com/275955) and [Firefox](https://bugzil.la/906896). This limit is per browser + domain, which means that you can open 6 SSE connections across all of the tabs to www.example1.com and another 6 SSE connections to www.example2.com (per [Stack Overflow](https://stackoverflow.com/questions/5195452/websockets-vs-server-sent-events-eventsource/5326159)). When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100).

Contributor guide

Open the contributing guide

Research direction

The issue does not name files or tests; start by tracing the SSE extension's EventSource setup. Review the linked issues for expected behavior around user-defined EventSource objects, external listeners, and connection reuse. Done means the requested object can control the SSE connection without breaking the extension's existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.