Skip to content

Miscellaneous

renderSSE()

renderSSE() — returns void

Available in: controller

Render a single SSE event as the controller response. This sets appropriate headers and formats the response as an SSE event. The client should use EventSource to connect and will receive this single event.

NameTypeRequiredDefaultDescription
datastringyesThe event data to send (string). Will be sent as-is.
eventstringnoOptional event type name. Client can listen for specific event types.
idstringnoOptional event ID. Client sends Last-Event-ID header on reconnect.
retrynumericno0Optional reconnection time in milliseconds. Tells client how long to wait before reconnecting.