Scoop API

scoop:scoop.http:0.1.0

WebSocketHandshake

class WebSocketHandshake

source · line 26
public
public class WebSocketHandshake internal constructor(
    /**
     * The validated upgrade request head.
     */
    public val request: HttpRequestHead,
        /**
         * The validated base64 client nonce used to verify Sec-WebSocket-Accept.
         */
        public val key: String,
    /**
     * The offered subprotocol tokens in request order.
     */
    public val protocols: Array<String>,
        /**
         * The parsed offered extensions.
         */
        public val extensions: Array<WebSocketExtension>
)

A validated HTTP/1 WebSocket upgrade request, nonce key, offered subprotocols, and extensions. Response validation remains tied to this exact request.

function negotiateResponse

source · line 57
public
public fun negotiateResponse(protocol: String? = None, deflate: WebSocketDeflate? = None, fields: List<HttpField> = emptyList<HttpField>()): WebSocketServerResponse

Constructs the response and retains its checked negotiation for the server session.

property protocols

source · line 38
public
public val protocols: Array<String>

get: public read-only

The offered subprotocol tokens in request order.

property key

source · line 34
public
public val key: String

get: public read-only

The validated base64 client nonce used to verify Sec-WebSocket-Accept.

function response

source · line 53
public
public fun response(protocol: String? = None, deflate: WebSocketDeflate? = None, fields: List<HttpField> = emptyList<HttpField>()): HttpResponseHead

Constructs a valid 101 response using a compatible offered subprotocol and compression selection.