Kemal::EventStream
Helper for Server-Sent Events (SSE) responses.
Sets the required headers and formats events according to the SSE spec.
Constructors
new(response : HTTP::Server::Response)
SourceClass methods
Runs an SSE handler with headers configured and yields an EventStream.
Instance methods
close
Sourcecomment(text : String) : self
Sends a keep-alive comment (ignored by clients, useful during idle periods).
flush
Sourcesend(data : String, *, event : String | Nil = nil, id : String | Int | Nil = nil, retry : Time::Span | Nil = nil) : self
Sends an SSE event. Multi-line data is split into separate data: fields.
event and id must not contain CR/LF; newlines there raise ArgumentError
so they cannot inject SSE fields.