webSocketRaw

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

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

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 websocket protocol (ignored if null) Requires WebSockets feature to be installed first

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 websocket protocol (ignored if null) Requires WebSockets feature to be installed first

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 websocket protocol (ignored if null) Requires WebSockets feature to be installed first

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.


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

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

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.