SseStreamResponseDefinition

A StreamResponseDefinition specialization for server-sent events.

Overrides configureHeaders to add SSE-specific headers and serialize to append a blank-line event terminator (\r\n) after each event per the SSE specification.

Author

Konstantin Pavlov

Parameters

chunkFlow

A Flow of ServerSentEvent representing the stream of SSE events. Defaults to emptyFlow.

chunkContentType

The ContentType for the chunks in the SSE stream. Defaults to null.

delay

An optional delay between chunks, specified as a Duration. Defaults to Duration.ZERO.

formatter

An HttpFormatter responsible for formatting the HTTP response or payloads.

Properties

Link copied to clipboard
Link copied to clipboard

The MIME type of the response content.

Link copied to clipboard
open val delay: Duration

A delay applied before sending the response. Defaults to Duration.ZERO.

Link copied to clipboard

Delay between the transmission of each chunk.

Link copied to clipboard

A lambda that configures the response headers. Defaults to null.

Link copied to clipboard

The HTTP status code of the response. Defaults to HttpStatusCode.OK.