Http4kSseClient

class Http4kSseClient(sseRequest: Request, http: HttpHandler, reconnectionMode: ReconnectionMode = Disconnect, reportError: (Exception) -> Unit = {}, maxQueueSize: Int = 1024) : SseClient(source)

Simple SSE client leveraging standard HttpHandlers. Tracks a single connection only and sends reconnection requests including the last event id.

The internal message queue is bounded by maxQueueSize; the producer thread will block (back-pressure) once it fills, so clients are required to consume messages using received() to keep the stream flowing.

Constructors

Link copied to clipboard
constructor(sseRequest: Request, http: HttpHandler, reconnectionMode: ReconnectionMode = Disconnect, reportError: (Exception) -> Unit = {}, maxQueueSize: Int = 1024)

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun received(): Sequence<SseMessage>
Link copied to clipboard

Use this client nd then close it