Package-level declarations

Types

Link copied to clipboard
class Heartbeat

Represents a heartbeat configuration for a ServerSSESession.

Link copied to clipboard
interface ServerSSESession : CoroutineScope

Represents a server-side Server-Sent Events (SSE) session. An ServerSSESession allows the server to send ServerSentEvent to the client over a single HTTP connection.

Link copied to clipboard

Represents a server-side Server-Sent Events (SSE) session with serialization support. An ServerSSESessionWithSerialization allows the server to send ServerSentEvent to the client over a single HTTP connection.

Link copied to clipboard
class SSEServerContent(    val call: ApplicationCall,     val handle: suspend ServerSSESession.() -> Unit,     val serialize: (TypeInfo, Any) -> String? = null) : OutgoingContent.WriteChannelContent

An OutgoingContent response object that could be used to respond(). It will start Server-Sent events SSE session.

Properties

Link copied to clipboard

Server-Sent Events (SSE) support plugin. It is required to be installed first before binding any sse endpoints.

Functions

Link copied to clipboard
fun ServerSSESession.heartbeat(heartbeatConfig: Heartbeat.() -> Unit = {})

Starts a heartbeat for the ServerSSESession.

Link copied to clipboard
inline suspend fun <T : Any> ServerSSESessionWithSerialization.send(data: T)
inline suspend fun <T : Any> ServerSSESessionWithSerialization.send(    data: T? = null,     event: String? = null,     id: String? = null,     retry: Long? = null,     comments: String? = null)
Link copied to clipboard
fun Route.sse(handler: suspend ServerSSESession.() -> Unit)
fun Route.sse(serialize: (TypeInfo, Any) -> String, handler: suspend ServerSSESessionWithSerialization.() -> Unit)

Adds a route to handle Server-Sent Events (SSE) using the provided handler. Requires SSE plugin to be installed.

fun Route.sse(path: String, handler: suspend ServerSSESession.() -> Unit)
fun Route.sse(path: String, serialize: (TypeInfo, Any) -> String, handler: suspend ServerSSESessionWithSerialization.() -> Unit)

Adds a route to handle Server-Sent Events (SSE) at the specified path using the provided handler. Requires SSE plugin to be installed.