webSocket

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

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

DefaultWebSocketSession.incoming will never contain any control frames and no fragmented frames could be found. Default websocket implementation is handling ping/pongs, timeouts, close frames and reassembling fragmented frames

When a websocket session is created, a handler lambda will be called with websocket session instance on receiver. Once handler function returns, the websocket termination sequence will be scheduled so you shouldn't use DefaultWebSocketSession anymore. However websocket could live for a while until close sequence completed or a timeout exceeds


fun <ERROR CLASS>.webSocket(webSocketProtocol: String, webSocketHandler: suspend DefaultWebSocketServerSession.() -> Unit, nothing: Nothing? = null)

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

DefaultWebSocketSession.incoming will never contain any control frames and no fragmented frames could be found. Default websocket implementation is handling ping/pongs, timeouts, close frames and reassembling fragmented frames

When a websocket session is created, a handler lambda will be called with websocket session instance on receiver. Once handler function returns, the websocket termination sequence will be scheduled so you shouldn't use DefaultWebSocketSession anymore. However websocket could live for a while until close sequence completed or a timeout exceeds


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

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

DefaultWebSocketSession.incoming will never contain any control frames and no fragmented frames could be found. Default websocket implementation is handling ping/pongs, timeouts, close frames and reassembling fragmented frames

When a websocket session is created, a handler lambda will be called with websocket session instance on receiver. Once handler function returns, the websocket termination sequence will be scheduled so you shouldn't use DefaultWebSocketSession anymore. However websocket could live for a while until close sequence completed or a timeout exceeds