Stream Response Definition
open class StreamResponseDefinition<T>(val chunkFlow: Flow<T>, val delayBetweenChunks: Duration = Duration.ZERO, contentType: ContentType = ContentType.Text.EventStream.withCharset(Charsets.UTF_8), chunkContentType: ContentType? = null, httpStatus: HttpStatusCode = HttpStatusCode.OK, headers: ResponseHeaders.() -> Unit? = null, delay: Duration, formatter: HttpFormatter) : AbstractResponseDefinition<T> (source)
Represents a definition for streaming responses, supporting flow-based content streaming. This class extends AbstractResponseDefinition to provide functionality specific to streamed responses. It handles flow-based content delivery, manages chunk-wise delays, and supports various output formats.
Author
Konstantin Pavlov
Type Parameters
T
The type of the response data being streamed.
See also
Inheritors
Constructors
Link copied to clipboard
constructor(chunkFlow: Flow<T>, delayBetweenChunks: Duration = Duration.ZERO, contentType: ContentType = ContentType.Text.EventStream.withCharset(Charsets.UTF_8), chunkContentType: ContentType? = null, httpStatus: HttpStatusCode = HttpStatusCode.OK, headers: ResponseHeaders.() -> Unit? = null, delay: Duration, formatter: HttpFormatter)
Properties
Link copied to clipboard
The MIME type of the response content.
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.