WebSockets

class WebSockets : CoroutineScope

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

install(WebSockets)

install(Routing) {
webSocket("/ws") {
incoming.consumeForEach { ... }
}
}

Parameters

pingIntervalMillis

duration between pings or null to disable pings.

timeoutMillis

write/ping timeout after that a connection will be closed.

maxFrameSize

maximum frame that could be received or sent.

masking

whether masking need to be enabled (useful for security).

extensionsConfig

is configuration for WebSocket extensions.

Constructors

Link copied to clipboard
fun WebSockets(pingIntervalMillis: Long, timeoutMillis: Long, maxFrameSize: Long, masking: Boolean)

Types

Link copied to clipboard
object Plugin

Plugin installation object.

Link copied to clipboard
class WebSocketOptions

Websockets configuration options

Properties

Link copied to clipboard
val contentConverter: <ERROR CLASS>?
Link copied to clipboard
open override val coroutineContext: CoroutineContext
Link copied to clipboard
val extensionsConfig: <ERROR CLASS>
Link copied to clipboard
val masking: Boolean
Link copied to clipboard
val maxFrameSize: Long
Link copied to clipboard
val pingIntervalMillis: Long
Link copied to clipboard
val timeoutMillis: Long

Extensions

Link copied to clipboard
val WebSockets.pingInterval: Duration?
Link copied to clipboard
val WebSockets.timeout: Duration