sse

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

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

Parameters

path

URL path at which to handle SSE requests.

handler

function that defines the behavior of the SSE session. It is invoked when a client connects to the SSE endpoint. Inside the handler, you can use the functions provided by ServerSSESession to send events to the connected clients.

See also


fun Route.sse(handler: suspend ServerSSESession.() -> Unit)

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

Parameters

handler

function that defines the behavior of the SSE session. It is invoked when a client connects to the SSE endpoint. Inside the handler, you can use the functions provided by ServerSSESession to send events to the connected clients.

See also