For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server-net/classes/WebSocket.md.

Class: WebSocket experimental

network

Beta

用于管理 WebSocket 连接。

Used to manage WebSocket connections.

Methods

connect()

connect(uri, headers?): Promise<WebSocketClient>

World Mutation Beta

Parameters

uri

string

要建立连接的 URL。

URL to make connection to.

headers?

HttpHeader[]

Returns

Promise<WebSocketClient>

一个可等待的 Promise,其结果为已连接的 WebSocket 客户端。

An awaitable promise that contains the WebSocket client that was connected.

Remarks

尝试连接一个 WebSocket 客户端。

Attempts to connect a WebSocket client.

同领域相关