WebSocket connection options. Please note that the supported options may vary across different platforms.

WebSocket连接选项。请注意,在不同的平台上,支持的选项可能会有所不同。

interface IWebSocketConnectOptions {
    forceCellularNetwork?: boolean;
    headers?: Record<string, string>;
    perMessageDeflate?: boolean;
    protocols?: string[];
    tcpNoDelay?: boolean;
    timeout?: number;
}

属性

forceCellularNetwork?: boolean

Force to use cellular network to send request

强制使用蜂窝网络发送请求

headers?: Record<string, string>

The headers to include in the request.

请求中包含的头部。

perMessageDeflate?: boolean

Whether to enable the compression extension

是否开启压缩扩展

protocols?: string[]

The subprotocol array.

子协议数组。

tcpNoDelay?: boolean

Whether to enable TCP_NODELAY.

是否启用TCP_NODELAY。

timeout?: number

The timeout in milliseconds.

超时时间,单位为毫秒