WsOptions 接口
🌐 WsOptions interface
浏览器的 WebSocket 连接选项。
🌐 Options for the WebSocket connection to the browser.
语法
🌐 Signature
export interface WsOptions
附注
🌐 Remarks
仅用于 Node.js 环境。
🌐 Only used in the Node.js environment.
属性
🌐 Properties
|
属性 🌐 Property |
修饰符 🌐 Modifiers |
类型 🌐 Type |
描述 🌐 Description |
默认 🌐 Default |
|---|---|---|---|---|
|
headers |
|
Record<string, string> |
用于 Web 套接字连接的标头。 🌐 Headers to use for the web socket connection. | |
|
keepAlive |
|
boolean |
是否发送 WebSocket ping,如果在同一时间间隔内没有收到 pong 就断开连接。这样可以检测到没有发送关闭帧就断开的连接,否则调用会一直挂起直到 🌐 Whether to send WebSocket pings and drop the connection when a pong does not come back within the same interval. Detects a connection that died without a close frame, which otherwise leaves calls hanging until |
|
|
keepAliveIntervalMs |
|
number |
以毫秒为单位的 Ping 间隔。只有在设置了 WsOptions.keepAlive 时才会使用。 🌐 Ping period in milliseconds. Only used when WsOptions.keepAlive is set. |
|
|
maxPayload |
|
number |
浏览器接收的单条消息的最大字节数。超过这个大小的消息会关闭连接。当协议响应(例如大 PDF 文件)无法适应时,可以增大它。 🌐 Maximum size in bytes of a single message received from the browser. Messages exceeding it close the connection. Raise it when a protocol response, such as a large PDF, does not fit. |
|