Skip to content

Added persistent server-sent event streams to the web server - #450

Merged
fdesbiens merged 4 commits into
eclipse-threadx:devfrom
fdesbiens:fix/http-event-stream
Oct 16, 2026
Merged

fdesbiens merged 4 commits into
eclipse-threadx:devfrom
fdesbiens:fix/http-event-stream

Conversation

@fdesbiens

@fdesbiens fdesbiens commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #298

The web server closes responses without a content length and expires idle sessions, preventing applications from sending events later. Packet exhaustion during event stream setup or send could also leave a thread waiting indefinitely.

Added explicit Server-Sent Events start and send APIs for HTTP and HTTPS. Only the selected stream stays open while idle; ordinary HTTP connections retain their timeout. Packet allocation and append return immediately on exhaustion, releasing the allocated packet and leaving stream state unchanged. The API is documented in eclipse-threadx/rtos-docs-asciidoc#83, with the packet exhaustion behavior clarified in eclipse-threadx/rtos-docs-asciidoc#109.

GCC 14 CMake/Ninja web suites passed 56/56 with TLS and 56/56 without TLS. The regression received an event after the normal idle timeout in both builds and covered both packet append failures. Changed production code reached 66/66 lines and 76/76 branches. Not run on hardware.

@fdesbiens
fdesbiens requested a review from rahmanih September 28, 2026 13:56
Fixes eclipse-threadx#298

The web server closes responses without a content length and expires idle
sessions, preventing applications from sending later events.

Added explicit start and send APIs that keep only the selected event stream open.
Ordinary HTTP connections retain their timeout.

The web suite passed 56/56 in the default build and 56/56 without TLS. The new
stream regression passed in both. Hardware was not tested.

Assisted-by: Codex (GPT-6) <noreply@openai.com>
The event stream branch could not merge because the web session files had
concurrent disclosure-line edits.

Keep the current header wording while retaining the event stream changes.
The conflict resolution does not change runtime behavior.

The GCC 14 CMake/Ninja web event stream regression passed 1/1 after the
integration. The full web CI matrix will run on the updated branch.

Assisted-by: Codex (gpt-6.1-sol) <noreply@openai.com>
@fdesbiens
fdesbiens marked this pull request as draft October 16, 2026 16:59
The event stream regression checked a successful delayed send but left
argument validation, caller context, packet allocation, and send failures
untested.

Added focused API and state checks, plus failed allocation, failed TCP
send, and oversized TLS record cases. The test restores live session
state after each injected failure.

GCC 14 CMake/Ninja web suites passed 56/56 with TLS and 56/56 without TLS.
Changed production code reached 66/66 lines and 74/76 branches; the two
uncovered packet append failure branches remain under review.

Assisted-by: Codex (gpt-6.1-sol) <noreply@openai.com>
The event stream start and send APIs waited forever when an append needed
another packet from an exhausted pool. This could stall the server callback
or the application thread sending an event.

Used NX_NO_WAIT for packet allocation and append in both APIs. A failed append
releases its packet, leaves the stream state unchanged, and returns the NetX
error. Added a one-packet pool regression for both paths.

GCC 14 CMake/Ninja web suites passed 56/56 with TLS and 56/56 without TLS.
Changed production code reached 66/66 lines and 76/76 branches. Not run on
hardware.

Assisted-by: Codex (gpt-6.1-sol) <noreply@openai.com>
@fdesbiens
fdesbiens marked this pull request as ready for review October 16, 2026 20:48
@fdesbiens
fdesbiens merged commit 8ad4572 into eclipse-threadx:dev Oct 16, 2026
17 checks passed
@fdesbiens
fdesbiens deleted the fix/http-event-stream branch October 16, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant