TsgcWebSocketProxyServerMethods › Ping

Ping Method

Sends a WebSocket ping frame to every connected client on the browser-facing side of the proxy.

Syntax

procedure Ping(const aText: string = '');

Parameters

NameTypeDescription
aTextconst stringOptional payload to carry inside the ping frame; pass an empty string to send a ping with no payload.

Remarks

Ping iterates the active WebSocket connection list and sends a WebSocket ping frame to each client, returning once the frames are handed to the underlying sockets. The ping only targets the WebSocket side of each tunnel, since the paired upstream TCP connection is a raw byte stream that does not carry WebSocket control frames. It is a convenient way to keep idle browser connections alive or to probe liveness manually. Any pong replies are delivered asynchronously through the standard connection events and exceptions raised while writing are routed to OnException.

Example


oServer.Ping('keepalive');

Back to Methods