webSocketRaw

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

Binds RAW WebSocket at the current route + path optionally checking the for WebSocket protocol (ignored if null) Requires WebSockets plugin to be installed.

Unlike regular (default) webSocket, a raw WebSocket is not handling any ping/pongs, timeouts or close frames. So WebSocketSession.incoming channel will contain all low-level control frames and all fragmented frames need to be reassembled.

When a WebSocket session is created, a handler lambda will be called with WebSocket session instance on receiver. Once handler function returns, the WebSocket connection will be terminated immediately. For RAW WebSockets it is important to perform close sequence properly.


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

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

Unlike regular (default) webSocket, a raw WebSocket is not handling any ping/pongs, timeouts or close frames. So WebSocketSession.incoming channel will contain all low-level control frames and all fragmented frames need to be reassembled.

When a WebSocket session is created, a handler lambda will be called with WebSocket session instance on receiver. Once handler function returns, the WebSocket connection will be terminated immediately. For RAW WebSockets it is important to perform close sequence properly.

Parameters

negotiateExtensions

indicates if the server should negotiate installed WebSocket extensions.


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

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

Unlike regular (default) webSocket, a raw WebSocket is not handling any ping/pongs, timeouts or close frames. So WebSocketSession's incoming channel will contain all low-level control frames and all fragmented frames need to be reassembled.

When a WebSocket session is created, a handler lambda will be called with WebSocket session instance on receiver. Once handler function returns, the WebSocket connection will be terminated immediately. For RAW WebSocket it is important to perform close sequence properly.


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

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

Unlike regular (default) webSocket, a raw WebSocket is not handling any ping/pongs, timeouts or close frames. So WebSocketSession's incoming channel will contain all low-level control frames and all fragmented frames need to be reassembled.

When a WebSocket session is created, a handler lambda will be called with WebSocket session instance on receiver. Once handler function returns, the WebSocket connection will be terminated immediately. For RAW WebSocket it is important to perform close sequence properly.

Parameters

negotiateExtensions

indicates if the server should negotiate installed WebSocket extensions.