Skip to content

Sse Event

1 min read

Import: import system.webapi;

For behavior and native target requirements, see Native Web APIs.

SseEvent

One server-sent event. Newlines in data are emitted as separate data lines.

public class SseEvent

data

Text payload of the event.

public data: string

event

Optional event type sent to the client.

public event: Option<string>

id

Optional event identifier used when reconnecting.

public id: Option<string>

retry

Optional reconnection delay in milliseconds.

public retry: Option<int>

constructor

Creates a SseEvent with data, event, id, retry.

public constructor(
    data: string,
    event: Option<string> = Option.None,
    id: Option<string> = Option.None,
    retry: Option<int> = Option.None
)

data

Creates an event with only a data payload.

public static fun data(text: string): SseEvent