TsgcWSAPIKeyManagerMethods › IsConnectionAllowed

IsConnectionAllowed Method

Server hook enforcing the optional IPAllowlist when FailClosed is True.

Syntax

function IsConnectionAllowed(const aIP: string): Boolean;

Parameters

NameTypeDescription
aIPconst stringPeer IP of the incoming TCP connection as reported by the server socket.

Return Value

False only when Enabled is True, Validation.FailClosed is True, Validation.IPAllowlist is non-empty and the supplied IP is not a member. True in every other case (allowlist empty, FailClosed off, component disabled). (Boolean)

Remarks

Server-side hook invoked automatically by TsgcWebSocketHTTPServer and TsgcWSServer_HTTPAPI when this manager is assigned to their APIKeyManager property. Runs before the HTTP headers are available, so it only enforces the IP allowlist — actual API-key authentication happens later from IsRequestAuthorized in OnConnect. Do not call it manually unless you are bridging the manager into a custom server loop.

Example

// Custom server loop bridging the manager
if not sgcWSAPIKeyManager1.IsConnectionAllowed(oPeer.IP) then
  oPeer.Disconnect;

Back to Methods