Supported by
TsgcWebSocketServer_HTTPAPI
On Server components, automatically sends a ping to all active WebSocket connections every x seconds.
On Client components, automatically sends a ping to the server every x seconds.
HeartBeat has the following properties:
Customize HeartBeat
Client and server components allow customization of HeartBeat to send custom pings and check that the connection is still alive. The event OnBeforeHeartBeat is built exactly for that; it allows you to send a custom message and/or not send the standard ping.
Example: send a message text as a ping every 30 seconds.
void OnBeforeHeartBeat(TObject Sender; const TsgcWSConnection Connection; ref bool Handled)
{
Connection.WriteData("ping");
Handled = true;
}