WebSocketUpgrade

class WebSocketUpgrade(call: <ERROR CLASS>, protocol: String?, installExtensions: Boolean, handle: suspend <ERROR CLASS>.() -> Unit)

An OutgoingContent response object that could be used to respond(): it will cause application engine to perform HTTP upgrade and start websocket RAW session.

Please note that you generally shouldn't use this object directly but use WebSockets plugin with routing builders webSocket instead.

handle function is applied to a session and as far as it is a RAW session, you should handle all low-level frames yourself and deal with ping/pongs, timeouts, close frames, frame fragmentation and so on.

Parameters

call

that is starting web socket session

protocol

web socket negotiated protocol name (optional)

installExtensions

specifies if WebSocket extensions should be installed in current session.

handle

function that is started once HTTP upgrade complete and the session will end once this function exit

Constructors

Link copied to clipboard
fun WebSocketUpgrade(call: <ERROR CLASS>, protocol: String? = null, handle: suspend <ERROR CLASS>.() -> Unit)

An OutgoingContent response object that could be used to respond(): it will cause application engine to perform HTTP upgrade and start websocket RAW session.

Link copied to clipboard
fun WebSocketUpgrade(call: <ERROR CLASS>, protocol: String? = null, installExtensions: Boolean = false, handle: suspend <ERROR CLASS>.() -> Unit)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend fun upgrade(input: <ERROR CLASS>, output: <ERROR CLASS>, engineContext: CoroutineContext, userContext: CoroutineContext): Job

Properties

Link copied to clipboard
val call: <ERROR CLASS>
Link copied to clipboard
val handle: suspend <ERROR CLASS>.() -> Unit
Link copied to clipboard
open val headers: <ERROR CLASS>
Link copied to clipboard
val protocol: String? = null