What are Server-Sent Events?
Server-Sent Events (SSE) is a standard that allows servers to push data to web clients over HTTP. Unlike WebSockets, SSE is unidirectional - the server sends events to the client.
Basic SSE Format
event: message
data: {"hello": "world"}
data: Just data, no event type
event: custom-event
id: 123
data: With event type and IDEach event can have:
data:The payload (required)event:Custom event type (optional, defaults to "message")id:Event identifier (optional)retry:Reconnection time in ms (optional)
SSE is widely used for AI streaming responses (OpenAI, Anthropic, Vercel AI SDK), real-time feeds, notifications, and live updates.
Supported Formats
Click "Try this" to see how Beautify Event Stream parses each format.
Standard SSE
The basic Server-Sent Events format as defined by the W3C specification.
event: message
data: {"status":"connected","user":"john_doe"}
event: update
data: {"count":42,"timestamp":"2024-01-15T10:30:00Z"}
event: message
data: {"status":"processing"}
data: Simple text without event type
event: done
data: {"status":"complete"}Vercel AI SDK
The streaming protocol used by Vercel AI SDK with prefixed message types (0: text, e: error, d: done).
0:"Hello"
0:" there"
0:"!"
0:" How"
0:" can"
0:" I"
0:" help"
0:" you"
0:" today"
0:"?"
e:{"finishReason":"stop","usage":{"promptTokens":10,"completionTokens":15},"isContinued":false}
d:{"finishReason":"stop","usage":{"promptTokens":10,"completionTokens":15}}OpenAI Streaming
The SSE format used by OpenAI chat completions API with delta chunks.
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]Anthropic Streaming
The SSE format used by Anthropic Claude API with content block deltas.
data: {"type":"message_start","message":{"id":"msg_01","type":"message","role":"assistant","model":"claude-3-opus-20240229"}}
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" World"}}
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"!"}}
data: {"type":"content_block_stop","index":0}
data: {"type":"message_stop"}