SSE stream parser

Paste a raw text/event-stream response to see what a browser would parse from it — and what it would silently drop.

Everything runs in your browser

Spec: HTML Standard: event stream interpretationHTML Standard: parsing an event stream

A .txt or .json file, up to 5 MB. You can also drop it onto the field.

The SSE stream format

Server-Sent Events is a plain-text format, served as text/event-stream in UTF-8. A stream is a sequence of lines, and each line is a field name, a colon and a value. A blank line ends the event and hands it to the page.

data
The payload. Several data lines in one event are joined with a newline. An event with no data line never fires.
event
The event type. Without it the type is message. A named event reaches only a listener added for that name with addEventListener; onmessage does not see it.
id
The event id. The browser remembers the last one and sends it back in the Last-Event-ID header when it reconnects.
retry
How long to wait before reconnecting, in milliseconds. Digits only.
:
A line that starts with a colon is a comment. The browser skips it, which makes it the usual keep-alive ping.

One space after the colon is removed, so data:x and data: x carry the same value. A line ends with LF, CRLF or a lone CR. Any other field name is skipped without an error.

Want to see more?

View in Solpuga

How to get the raw stream

The parser needs the text exactly as the server sent it. There are three ways to get it:

  • curl -N https://example.com/events. The -N flag turns off the buffering in curl itself, so events print as they arrive. If the server checks the header, add -H "Accept: text/event-stream".
  • Browser DevTools. On the Network tab pick the request and open EventStream. It lists only the events that fired: a dropped event is simply not there. For the raw text use curl or a proxy.
  • A debugging proxy: Charles, Fiddler, Proxyman or Solpuga. It records the response body for any client: a mobile app, a backend service, a browser with DevTools closed.

Questions about Server-Sent Events

What is Server-Sent Events (SSE)?

A way for a server to push events to a client over one long HTTP response. The client opens the connection, with EventSource in a browser or with fetch anywhere else, and the server keeps writing events into it. The stream goes one way and carries text only, and the browser reconnects by itself when the connection drops. Notifications, live dashboards and the token-by-token replies of LLM APIs work this way.

What is the difference between SSE and WebSocket?

SSE is ordinary HTTP: data goes from server to client only, as text, and reconnection with Last-Event-ID is built in. WebSocket is a separate protocol, reached by a request with Upgrade: data goes both ways, as text or binary, and reconnection is yours to write. If the client only listens, SSE is simpler. Over HTTP/1.1 a browser keeps at most six connections per host, and every open SSE stream takes one of them.

Why does onmessage not fire?

Usually for one of three reasons. The event has an event field: a named event goes only to addEventListener with that name, and onmessage does not see it. The event has no data line, so it is not dispatched at all. Or the server wrote one newline after the event instead of two, and the browser is still waiting for the blank line. The parser above shows the type of every event and reports the other two cases.

Can I paste an OpenAI or Anthropic stream?

Yes. LLM APIs answer over SSE, so the response is an ordinary event stream. OpenAI Chat Completions sends unnamed events and ends with data: [DONE]. That line is a convention of the API, and to the parser it is one more event. Anthropic names its events (content_block_delta, message_stop), and the names show in the type column.

Is the stream I paste sent to a server?

No. A script on this page parses the text, and it never leaves the tab. You can check on the Network tab of DevTools: no request from the page carries the text.

When a stream misbehaves