TsgcWebSocketFirewallMethods › RegisterConnection

RegisterConnection Method

Records a new accepted connection for the given IP, incrementing the per-IP counters used by RateLimit and feeding the ThreatScore decay window.

Syntax

procedure RegisterConnection(const aIP: string);

Parameters

NameTypeDescription
aIPconst stringIPv4 or IPv6 address of the client whose connection has just been accepted.

Remarks

RegisterConnection is invoked automatically by the server integration right after IsConnectionAllowed returns True. Call it yourself only when wiring the firewall into a custom transport that bypasses the built-in servers. Every call must be balanced by a matching UnregisterConnection on disconnect, otherwise the rate-limit counters grow unbounded.

Example

// manual wiring for a custom transport
procedure TMyTransport.OnAccept(const aIP: string);
begin
  sgcWebSocketFirewall1.RegisterConnection(aIP);
end;

Back to Methods