SseEvent
struct SseEventA single Server-Sent Event.
Fields:
data: Event payload. May contain newlines — they're split
into multiple data: lines on the wire per
WHATWG §9.2.4.
event_type: Optional event-type name. Default empty (the
client default of "message" applies).
id: Optional event id (for Last-Event-Id resumption).
Default empty.
retry_ms: Optional reconnection backoff hint, in
milliseconds. Default -1 (don't emit a retry:
line).
Constructors:
- :meth:SseEvent.data — the 80% case (just data).
- :meth:SseEvent.named — typed event with explicit
event-type.
Implements Copyable, Movable
- Fields
data: Stringevent_type: Stringid: Stringretry_ms: Int
message
def message(payload: String) -> Self Construct an event with just a data payload (no explicit event-type — the client default "message" applies).
named
def named(event_type: String, payload: String) -> Self Construct an event with a named event: type.