ktor-websockets / io.ktor.websocket / io.ktor.routing.Route

Extensions for io.ktor.routing.Route

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(webSocketProtocol: String, webSocketHandler: suspend DefaultWebSocketServerSession.() -> Unit, nothing: Nothing? = null): 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
fun Route.webSocketRaw(path: String, protocol: String? = null, negotiateExtensions: Boolean = false, 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
fun Route.webSocketRaw(protocol: String? = null, negotiateExtensions: Boolean = false, 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

fun Route.webSocketRaw(webSocketProtocol: String, webSocketHandler: suspend WebSocketServerSession.() -> Unit, nothing: Nothing? = null): Unit

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