Manuscript Documentation
v2026.12.0

@std/net/sse.ms#

Import each required symbol with import Name from "@std/net/sse.ms".

SseEvent Type#

One dispatched event, with the message type used when no event: field was sent.

Manuscript
type SseEvent {
    event String
    data String
    id String? = null
    retry Int? = null
}

SseEvent.data#

Every data: line of the event joined with LF; a bare data: line gives an empty line.

Manuscript
data String

SseEvent.event#

The event type from the last event: field, or message.

Manuscript
event String

SseEvent.id#

The last event ID in effect when the event was dispatched, or null if the stream never set one.

Manuscript
id String? = null

SseEvent.retry#

The latest valid retry: reconnection time in milliseconds sent up to this event, or null if the stream sent none.

Manuscript
retry Int? = null

SseLimits Type#

Optional byte limits for one line and for one event. A supplied limit must be positive.

Manuscript
type SseLimits {
    max_line_bytes Int? = null
    max_event_bytes Int? = null
}

SseLimits.max_event_bytes#

Largest total of all field lines in one event, excluding line endings and comments; null sets no limit.

Manuscript
max_event_bytes Int? = null

SseLimits.max_line_bytes#

Largest line in bytes, excluding its line ending; null sets no limit.

Manuscript
max_line_bytes Int? = null

sse_events Function#

Decodes a Server-Sent Events byte stream into events, in order.

Chunks may split any line, line ending or UTF-8 scalar. A stream with no partial line and no unfinished event ends cleanly; otherwise the final read fails with EBADMSG and the unfinished event is never dispatched. A malformed line or an exceeded limit fails the read, and the failure is final. Supplied limits must be positive, otherwise the first read fails with EINVAL. Closing the result closes input.

Manuscript
fn sse_events(move input ReadStream[Bytes], limits SseLimits = SseLimits()) ReadStream[SseEvent] { ... }