ServerSSESession

interface ServerSSESession : CoroutineScope

Represents a server-side server-sent events session. An ServerSSESession allows the server to send ServerSentEvent to the client over a single HTTP connection.

See also

Properties

Link copied to clipboard
abstract val call: ApplicationCall

Associated received call that originating this session.

Link copied to clipboard

Functions

Link copied to clipboard
abstract suspend fun close()

Closes the ServerSSESession, terminating the connection with the client. Once this method is called, the SSE session is closed and no further events can be sent. You don't need to call this method as it is called automatically when all the send operations are completed.

Link copied to clipboard
abstract suspend fun send(event: ServerSentEvent)

Sends a ServerSentEvent to the client.

open suspend fun send(data: String? = null, event: String? = null, id: String? = null, retry: Long? = null, comments: String? = null)

Creates and sends a ServerSentEvent to the client.