TsgcWSAPIServer_WebPushMethods › KeepAlive

KeepAlive Method

Inherited helper that writes a keepalive/ping frame to a single WebSocket connection so idle links stay open through proxies.

Syntax

procedure KeepAlive(const aConnection: TsgcWSConnection; const aMessage: string);

Parameters

NameTypeDescription
aConnectionconst TsgcWSConnectionWebSocket connection held by the attached server that should receive the keepalive frame.
aMessageconst stringOptional payload carried inside the keepalive frame; pass an empty string for a bare ping.

Remarks

Exposed by the base API server class for scenarios where the same component also manages long-lived WebSocket sessions alongside the Web Push HTTP endpoints. Typical Web Push traffic is short-lived HTTPS POSTs to the browser push service and does not require keepalives, so you normally only call this method when you have upgraded a client to WebSocket through the same listener.

Example

sgcWSAPIServer_WebPush1.KeepAlive(aConnection, '');

Back to Methods