TsgcWebSocketFirewall › Methods › IsConnectionAllowed
Core handshake filter. Evaluates every enabled connection-time protection module (bans, whitelist, blacklist, rate limit, GeoIP, custom rules) and returns whether the connection should be accepted.
function IsConnectionAllowed(const aIP: string): Boolean;
| Name | Type | Description |
|---|---|---|
aIP | const string | Remote client address as reported by the underlying socket. Both IPv4 and IPv6 are supported. |
True when the connection passes every enabled check; False if any module rejects it. On rejection OnFiltered and OnViolation fire with the matching violation type. (Boolean)
IsConnectionAllowed is the primary entry point invoked by TsgcWebSocketServer, TsgcWebSocketHTTPServer and TsgcWebSocketServer_HTTPAPI at handshake time as soon as the Firewall property is assigned, so manual calls are rarely required. It applies the modules in the documented order: if the IP is whitelisted, all further checks are skipped and True is returned; otherwise bans, blacklist, rate limit, GeoIP and CustomRules are evaluated sequentially. The method is thread-safe and updates Stats and threat-score counters as it runs.
// manual pre-filter (usually not needed — wiring the Firewall property is enough)
if not sgcWebSocketFirewall1.IsConnectionAllowed(Connection.IP) then
Connection.Disconnect;