SseMessage
Defined in: sse.ts:20
SSE parsing.
Deliberately NOT EventSource, for three reasons that each cost real
behaviour:
- EventSource cannot set request headers, so it cannot send
st-protocol— negotiation would be query-param-only forever. - EventSource reconnects automatically and silently. On a stream that
ends in
errorthat means retrying a request the server already answered definitively, repeatedly, from inside a customer’s page. - EventSource cannot read response headers, so the client could never see which protocol version it actually got.
fetch + a manual parser gives all three back. The cost is ~80 lines, which is a good trade for not having a background reconnect loop we do not control.
Properties
Section titled “Properties”data:
string
Defined in: sse.ts:24
data: payload, lines joined with “\n”.
event:
string
Defined in: sse.ts:22
event: name. Unnamed messages arrive as “message”, per the spec.