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 colon

According to the SSE specification, the correct format requires a space character after the colon.

Expected Behavior

_, _ = w.WriteString("data: ") // With space after colon

Impact

This deviation from the specification may cause compatibility issues with: 1. Strict SSE client implementations 2. Middleware that enforces protocol compliance 3. Browsers that follow the specification strictly

Steps to Reproduce

  1. Send any event data through the SSE stream
  2. Observe the raw output format
  3. 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: #