mirror of
https://github.com/bigskysoftware/htmx.git
synced 2026-02-24 17:09:25 +00:00
Move SSE out of htmx core into a standalone extension (hx-sse.js). The new extension uses Fetch + ReadableStream instead of EventSource, so it works with POST, custom headers, and cookies. Two modes: - One-off streams: any hx-get/hx-post returning text/event-stream - Persistent connections: hx-sse:connect with auto-reconnect SSE events now follow the extension pattern: - htmx:before:sse:connection / htmx:after:sse:connection - htmx:before:sse:message / htmx:after:sse:message - htmx:sse:error / htmx:sse:close New features: - hx-sse:close="eventname" to close connection on a named event - htmx:sse:close event with reason (message, removed, ended, etc.) - htmx:before:response core event for extension response interception - Server retry: field updates reconnect delay per SSE spec - Non-2xx reconnect responses fire htmx:sse:error SSE parser improvements (spec compliance): - Handle CRLF, CR, and LF line endings - Strip leading BOM (U+FEFF) - Dispatch empty data fields - Ignore id fields containing NULL - Process field-only lines (no colon) per spec Docs: - Document htmx:before:response in events, reference, building guide - Add htmx 2.x → 4.x SSE migration guide - Document hx-sse:close and htmx:sse:close - Add hx-sse:connect, hx-sse:close to JetBrains web-types - Fix stale Accept header reference in migration guide Remove htmx.config.sse from core config tables (extension-only now). Remove stale SSE event references from core docs.