-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Open
Description
The current implementation of the writeData function in sse-encoder.go generates invalid Server-Sent Events (SSE) output by omitting the required space character after the data: field identifier.
Current behavior:
_, _ = w.WriteString("data:") // Missing space after colonAccording to the SSE specification, the correct format requires a space character after the colon.
Expected Behavior
_, _ = w.WriteString("data: ") // With space after colonImpact
This deviation from the specification may cause compatibility issues with:
- Strict SSE client implementations
- Middleware that enforces protocol compliance
- Browsers that follow the specification strictly
Steps to Reproduce
- Send any event data through the SSE stream
- Observe the raw output format
- Notice the missing space after
data:field
Proposed Solution
Update the writeData function to include the required space character after the colon. A fix is already implemented in PR #.
References
- W3C Server-Sent Events Specification: https://www.w3.org/TR/eventsource/
- MDN Web Docs: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
- Related fix: #
Copilot
Metadata
Metadata
Assignees
Labels
No labels