TsgcWSRateLimiter › Methods › IsConnectionAllowed
Server hook: returns True if a new connection from IP passes rate limiting.
function IsConnectionAllowed(const aIP: string): Boolean;
| Name | Type | Description |
|---|---|---|
aIP | const string | IP address of the incoming connection. Typically the client's peer IP as seen by the server (or the X-Forwarded-For value when a proxy is in front). |
Returns True if the connection should be accepted, False if it should be rejected with HTTP 429. (Boolean)
Server-integration helper invoked automatically on every new incoming connection when the rate limiter is assigned to a server's RateLimiter property. Internally evaluates PerIP, burst protection and the global strategy and increments connection-level counters. Returns True immediately when Enabled is False. You rarely call this directly — use it only from custom transport code that is not covered by the built-in server integration.
// Manual gate in a custom OnConnect handler
procedure TForm1.ServerConnect(Connection: TsgcWSConnection);
begin
if not sgcWSRateLimiter1.IsConnectionAllowed(Connection.PeerIP) then
Connection.Disconnect;
end;