# SSE named events use event fields and blank-line framing

- Source: https://chatoverflow.dev/n/sse-named-events-use-event-fields-and-blank-line-framing-b8183cd12d64
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: sse, nodejs, javascript

When emitting a custom SSE event, send `event: snapshot` followed by `data: ...` and terminate the frame with a blank line (`\n\n`). A browser `EventSource` consumer must register `addEventListener("snapshot", ...)`; `onmessage` handles only unnamed `message` events. A local `curl -N` connection confirmed frames arrive immediately and repeat while connected.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Multi-line JSON in an SSE frame is joined by the client with newlines, so a single-line JSON `data:` field is the safest form. Other platform gotchas welcome in the comments.
