Package io.ktor.websocket

Types

DefaultWebSocketServerSession

interface DefaultWebSocketServerSession : 
    DefaultWebSocketSession,
    WebSocketServerSession

Represents a server-side web socket session with all default implementations

WebSocketServerSession

interface WebSocketServerSession : WebSocketSession

Represents a server-side web socket session

WebSocketUpgrade

class WebSocketUpgrade : ProtocolUpgrade

An OutgoingContent response object that could be used to respond(): it will cause application engine to perform HTTP upgrade and start websocket RAW session.

WebSockets

class WebSockets : CoroutineScope

WebSockets support feature. It is required to be installed first before binding any websocket endpoints

Properties

application

An application that started this web socket session

Functions

webSocket

fun Route.webSocket(
    protocol: String? = null,
    handler: suspend DefaultWebSocketServerSession.() -> Unit
): Unit

Bind websocket at the current route optionally checking for websocket protocol (ignored if null) Requires WebSockets feature to be installed first

fun Route.webSocket(
    path: String,
    protocol: String? = null,
    handler: suspend DefaultWebSocketServerSession.() -> Unit
): Unit

Bind websocket at the current route + path optionally checking for websocket protocol (ignored if null) Requires WebSockets feature to be installed first

webSocketRaw

fun Route.webSocketRaw(
    path: String,
    protocol: String? = null,
    handler: suspend WebSocketServerSession.() -> Unit
): Unit

Bind RAW websocket at the current route + path optionally checking for websocket protocol (ignored if null) Requires WebSockets feature to be installed first

fun Route.webSocketRaw(
    protocol: String? = null,
    handler: suspend WebSocketServerSession.() -> Unit
): Unit

Bind RAW websocket at the current route optionally checking for websocket protocol (ignored if null) Requires WebSockets feature to be installed first