@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.
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.
data StringSseEvent.event#
The event type from the last event: field, or message.
event StringSseEvent.id#
The last event ID in effect when the event was dispatched, or null if the stream never set one.
id String? = nullSseEvent.retry#
The latest valid retry: reconnection time in milliseconds sent up to this
event, or null if the stream sent none.
retry Int? = nullSseLimits Type#
Optional byte limits for one line and for one event. A supplied limit must be positive.
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.
max_event_bytes Int? = nullSseLimits.max_line_bytes#
Largest line in bytes, excluding its line ending; null sets no limit.
max_line_bytes Int? = nullsse_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.
fn sse_events(move input ReadStream[Bytes], limits SseLimits = SseLimits()) ReadStream[SseEvent] { ... }