Skip to content

basalt / http/src / SseEvent

Interface: SseEvent ​

Defined in: http/src/sse.ts:9

Typed Server-Sent Events, adapter-agnostic. A handler returns sse(async (stream) => { … }); each adapter renders it against its own transport (a Node response on Fastify/Express, a ReadableStream on Hono). The producer drives the stream: send() an event, close() to end, and onClose() to react to the client disconnecting.

Properties ​

data ​

> data: unknown

Defined in: http/src/sse.ts:11

Payload — objects are JSON-encoded, strings sent as-is (split across data: lines).


event? ​

> optional event?: string

Defined in: http/src/sse.ts:13

SSE event name (the client's addEventListener(name)).


id? ​

> optional id?: string

Defined in: http/src/sse.ts:15

Event id (drives Last-Event-ID reconnection).


retry? ​

> optional retry?: number

Defined in: http/src/sse.ts:17

Client reconnection delay hint (ms).

Released under the MIT License.