class HttpWebSocketSession
source · line 14public class HttpWebSocketSession internal constructor(internal val state: ClientWebSocketState, private val call: ClientCall,
/**
* The final response or accepted handshake head.
*/
public val head: HttpResponseHead, negotiation: WebSocketNegotiation) : AsyncCloseable
- Supertype
AsyncCloseable
An owned HTTP/1.1 WebSocket session with handshake history and streaming messages. Successful upgrade ends the handshake total deadline; session lifecycle is explicit.
property deflate
source · line 54public val deflate: WebSocketDeflateNegotiation?
get: public read-only
Effective permessage-deflate settings, or None.
property proxyAuthenticationCount
source · line 42public val proxyAuthenticationCount: Long
get: public read-only
The number of proxy authentication retries before this result.
function pong
source · line 107public suspend fun pong(payload: List<Byte> = emptyList<Byte>()): Unit
Sends a pong control frame with a payload of at most 125 bytes.
parameter payload
source · line 107payload: List<Byte> = emptyList<Byte>()
property isClosed
source · line 58public val isClosed: Boolean
get: public read-only
Whether the underlying session is closed.
getter get
source · line 58get(): Boolean
function shutdownGracefully
source · line 112public suspend fun shutdownGracefully(value: WebSocketClose = WebSocketClose(Some(1000U))): WebSocketClose
Sends Close and waits for the peer reply under the session's close timeout, returning the peer close value.
parameter value
source · line 112value: WebSocketClose = WebSocketClose(Some(1000U))
function sendText
source · line 86public suspend fun sendText(text: String, compress: Boolean = true): Unit
Sends one complete UTF-8 text message, with compression when enabled and negotiated.
parameter compress
source · line 86compress: Boolean = true
parameter text
source · line 86text: String
function sendBinary
source · line 90public suspend fun sendBinary(bytes: List<Byte>, compress: Boolean = true): Unit
Sends one complete binary message, with compression when enabled and negotiated.
parameter bytes
source · line 90bytes: List<Byte>
parameter compress
source · line 90compress: Boolean = true
property protocol
source · line 50public val protocol: String?
get: public read-only
The selected subprotocol, or None.
function beginMessage
source · line 76public suspend fun beginMessage(type: WebSocketMessageType, compress: Boolean = true): WebSocketMessageWriter
Begins one outgoing text or binary message and returns a writer that must be finished or closed. Compression is used only when negotiated.
parameter compress
source · line 76compress: Boolean = true
parameter type
source · line 76type: WebSocketMessageType
property redirectHistory
source · line 26public val redirectHistory: Array<HttpRedirect>
get: public read-only
Completed redirect steps in order.
property sentClose
source · line 66public val sentClose: WebSocketClose?
get: public read-only
The locally sent close status and reason, when present.
getter get
source · line 66get(): Option<WebSocketClose>
property peerClose
source · line 62public val peerClose: WebSocketClose?
get: public read-only
The received close status and reason, when present.
getter get
source · line 62get(): Option<WebSocketClose>
property url
source · line 22public val url: Url
get: public read-only
The final URL after redirects.
property metrics
source · line 46public val metrics: HttpAttemptMetrics?
get: public read-only
The latest optional attempt-metrics snapshot.
getter get
source · line 46get(): Option<HttpAttemptMetrics>
function receive
source · line 82public suspend fun receive(): WebSocketMessage?
Returns the next owned incoming message, or None after normal session end; finish or close a message before reading the next.
property head
source · line 18public val head: HttpResponseHead
get: public read-only
The final response or accepted handshake head.
function ping
source · line 103public suspend fun ping(payload: List<Byte> = emptyList<Byte>()): Unit
Sends a ping control frame with a payload of at most 125 bytes.
parameter payload
source · line 103payload: List<Byte> = emptyList<Byte>()
function awaitClosed
source · line 117public suspend fun awaitClosed(): Unit
Waits for session termination and reports its failure according to session rules.
function close
source · line 122public override suspend fun close(): Unit
- Overrides
close
Closes the local session and awaits cleanup; use shutdownGracefully for an explicit close-handshake wait.
function send
source · line 95public suspend fun send(type: WebSocketMessageType, source: AsyncByteSource, compress: Boolean = true): Unit
Streams one message from the borrowed source; cancellation waits for source work and required cleanup.
parameter type
source · line 95type: WebSocketMessageType
parameter compress
source · line 95compress: Boolean = true
parameter source
source · line 95source: AsyncByteSource
property authenticationCount
source · line 38public val authenticationCount: Long
get: public read-only
The number of origin authentication retries before this result.
property retryCount
source · line 34public val retryCount: Long
get: public read-only
The number of retries before this result.
property failure
source · line 70public val failure: Throwable?
get: public read-only
The session's terminal failure, if any.
getter get
source · line 70get(): Option<Throwable>