WebSocketUpgrade
class WebSocketUpgrade : ProtocolUpgrade
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 feature 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
WebSocketUpgrade( WebSocketUpgrade( An OutgoingContent response object that could be used to |
Properties
val call: ApplicationCall that is starting web socket session |
|
val handle: suspend WebSocketSession.() -> Unit function that is started once HTTP upgrade complete and the session will end once this function exit |
|
val headers: Headers Headers to set when sending this content |
|
val protocol: String? web socket negotiated protocol name (optional) |
Inherited Properties
val status: HttpStatusCode? Status code to set when sending this content |
Functions
suspend fun upgrade( Upgrades an HTTP connection |
Extension Properties
var OutgoingContent.caching: CachingOptions? Gets or sets CacheControl instance as an extension property on this content |
|
val OutgoingContent. Retrieves LastModified and ETag versions from this OutgoingContent headers |
|
var OutgoingContent.versions: List<Version> Gets or sets list of Version instances as an extension property on this content |
Extension Functions
suspend fun OutgoingContent.toByteArray(): ByteArray |
|
suspend fun OutgoingContent.toByteReadPacket(): ByteReadPacket |
|
fun OutgoingContent.wrapHeaders( Generates a new OutgoingContent of the same abstract type but with OutgoingContent.headers transformed by the specified block. |