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/WebSocketClient.md.

Class: WebSocketClient experimental

network

Beta

一个活跃的 WebSocket 客户端。

An active WebSocket client.

Properties

afterEvents

readonly afterEvents: WebSocketClientAfterEvents

Beta

Remarks

包含与此 WebSocket 客户端相关的一组事件。

Contains a set of events related to this WebSocket client.


isOpen

readonly isOpen: boolean

Beta

Remarks

如果当前已连接到服务器,则为 true。

Set to true if the socket is current connected to the server.

Methods

close()

close(): void

World Mutation Beta

Returns

void

Remarks

关闭与服务器的连接。

Closes the connection with the server.

Throws

This function can throw errors.

WebSocketNotConnectedError


send()

send(payload): void

World Mutation Beta

Parameters

payload

string

将被包含在网络数据包中的有效负载。 The payload that will be included in the network packet.

Returns

void

Remarks

将提供的有效负载发送到服务器。

Sends the provided payload to the server.

Throws

This function can throw errors.

RequestBodyTooLargeError

WebSocketNotConnectedError

同领域相关