TsgcWebSocketFirewallMethods › IsMessageAllowed

IsMessageAllowed Method

Core per-message filter. Runs the enabled content-inspection modules (SQL injection, XSS, path traversal, command injection, payload limit, flood protection, custom rules) and returns whether the message should be delivered.

Syntax

function IsMessageAllowed(const aIP: string; const aMessage: string): Boolean;

Parameters

NameTypeDescription
aIPconst stringRemote client address that sent the message. Used for per-IP flood counters, threat-score attribution and ban escalation.
aMessageconst stringFull message payload (text or decoded binary) that will be scanned for malicious patterns and compared against PayloadLimit.MaxSizeBytes.

Return Value

True when the message passes every enabled filter; False when any module reports a violation. OnFiltered and OnViolation fire on rejection and the threat score is updated accordingly. (Boolean)

Remarks

IsMessageAllowed is invoked automatically for every text/binary frame once the Firewall property is wired to a server; it rarely needs to be called manually. Detection results accumulate into the ThreatScore subsystem, so recurrent offenders can be banned automatically once AutoBanThreshold is reached. For pipelines that already decoded a message off-thread, call IsMessageAllowed to re-apply the same filters before persisting or forwarding the payload.

Example

if not sgcWebSocketFirewall1.IsMessageAllowed(Connection.IP, aText) then
  Connection.Disconnect;

Back to Methods