TsgcWebSocketLoadBalancerServer › Methods › Ping
Sends a WebSocket ping frame to every client connected through the load balancer.
procedure Ping(const aText: string = '');
| Name | Type | Description |
|---|---|---|
aText | const string | Optional payload to carry inside the ping frame; pass an empty string to send a ping with no payload. |
Ping iterates the active connection list and sends a WebSocket ping frame to each client attached to the load balancer, returning once the frames are handed to the underlying sockets. The call is forwarded to every registered backup server so that pings reach clients hosted on remote nodes as well. It is a convenient way to keep idle connections alive or to probe liveness manually in addition to the automatic HeartBeat mechanism. When the HeartBeat timeout is configured, the server closes any connection that does not answer within the window; without a timeout the call is fire-and-forget and any pong replies are delivered asynchronously through the standard connection events. Exceptions raised while writing are routed to OnException.
oServer.Ping('keepalive');