Skip to content

fix: preserve multiline SSE events - #29

Open
Marve10s wants to merge 1 commit into
tiesen243:mainfrom
Marve10s:fix/sse-multiline-events
Open

Marve10s wants to merge 1 commit into
tiesen243:mainfrom
Marve10s:fix/sse-multiline-events

Conversation

@Marve10s

Copy link
Copy Markdown

An SSE event with several data: fields currently triggers one callback per line. A JSON object split across three fields therefore arrives as three strings instead of one object.

Feed intact text chunks to Effect's SSE parser and parse JSON after each completed event. Heartbeat detection keeps its line-based handling on the same shared response body, and server retry: directives leave the existing reconnect policy intact.

This follows SSE framing: raw whitespace is preserved, events dispatch on a blank line, and incomplete trailing events are discarded. Effect's existing limit on pending parser state also applies.

The tests retain a passing single-line control and catch three framing regressions on main. All pass with the fix and also verify cancellation when unsubscribing.

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