WebSockets
class WebSockets constructor(pingIntervalMillis: Long, timeoutMillis: Long, maxFrameSize: Long, masking: Boolean, extensionsConfig: WebSocketExtensionsConfig) : CoroutineScope
Content copied to clipboard
WebSockets support feature. It is required to be installed first before binding any websocket endpoints
install(WebSockets)
install(Routing) {
webSocket("/ws") {
incoming.consumeForEach { ... }
}
}
Content copied to clipboard
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)
Content copied to clipboard
Link copied to clipboard
fun WebSockets(pingIntervalMillis: Long, timeoutMillis: Long, maxFrameSize: Long, masking: Boolean, extensionsConfig: WebSocketExtensionsConfig)
Content copied to clipboard
Types
Link copied to clipboard
object Feature : ApplicationFeature<Application, WebSockets.WebSocketOptions, WebSockets>
Content copied to clipboard
Feature installation object.
Link copied to clipboard
Websockets configuration options