TsgcWSRateLimiterMethods › RegisterConnection

RegisterConnection Method

Registers a new connection for tracking (called automatically by the server).

Syntax

procedure RegisterConnection(const aIP: string);

Parameters

NameTypeDescription
aIPconst stringIP address of the client whose connection is being registered. Used as the tracking key inside the internal connection table.

Remarks

Adds the IP to the internal connection-tracking table and increments the ActiveKeys counter exposed through Stats. When the rate limiter is assigned to a server's RateLimiter property this is called automatically after IsConnectionAllowed returns True. Call it manually only from custom transport code where the built-in integration is not available. Always pair each RegisterConnection with a matching UnregisterConnection on disconnect to avoid stale counters.

Example

procedure TForm1.ServerConnect(Connection: TsgcWSConnection);
begin
  sgcWSRateLimiter1.RegisterConnection(Connection.PeerIP);
end;

Back to Methods