TsgcWSAPIClient_MCP › Methods › Ping
Issues a JSON-RPC ping request to keep the session alive.
procedure Ping;
Sends a ping JSON-RPC request and raises OnMCPPing when the server replies. The session must be in aimcpstInitialized state. When MCPOptions.HeartBeat.Enabled is True the component fires this method automatically at the configured interval, so manual calls are only required when implementing custom watchdog logic or measuring round-trip latency.
MCP.OnMCPPing := OnPingHandler;
MCP.Ping;
// inside the handler
procedure TMainForm.OnPingHandler(Sender: TObject;
const aRequest: TsgcAI_MCP_Request_Ping;
const aResponse: TsgcAI_MCP_Response_Ping);
begin
Log('ping ack: ' + aResponse.Write);
end;