tencent cloud

Socket Overview
Last updated:2025-03-11 20:32:31
Socket Overview
Last updated: 2025-03-11 20:32:31
After successfully establishing a WebSocket connection, PTS passes the created ws.Socket object into the callback function, allowing users to define the WebSocket request logic by calling the methods of the Socket.

Methodology

Methodology
Return Type
Description
close()
void
Close connection.
void
Listen for message events and process events according to the callback; the list of events currently supported by PTS is as follows:
Open: Establish the connection.
Close: Close the connection.
Message: Receive text messages.
binaryMessage: Receive binary messages.
pong: Receive pong messages.
ping: Receive ping messages.
ping()
void
Send ping messages.
send(msg)
void
Send text messages.
void
Send binary messages.
void
Set the polling function.
void
Set the loop executed function.
void
Set the timeout function.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback