KestrunContext.WriteSseEventAsync method

Writes a Server-Sent Event (SSE) to the response stream.

public Task WriteSseEventAsync(string? @event, string data, string? id = null, int? retryMs = null, 
    CancellationToken ct = default)
parameter description
event The event type
data The data payload of the event
id The event ID.
retryMs Reconnection time in milliseconds
ct Cancellation token

Return Value

Task representing the asynchronous write operation.

See Also