TsgcWebSocketServerProperties › Firewall

Firewall Property

Assigns a firewall component that filters incoming connections by IP, region or custom rules.

Syntax

property Firewall: TsgcWSFirewall read FFirewall write SetFirewall;

Default Value

nil

Remarks

Drop a TsgcWebSocketFirewall component on the form (or create it at runtime) and assign it to Firewall to enable allow/deny rules for incoming connections based on IP address, CIDR range or a custom policy. When assigned, every new TCP connection is matched against the firewall rules before the WebSocket handshake is processed; rejected peers are dropped immediately. This property is compiled only when the SGC_FIREWALL conditional is defined. Leave unassigned to disable the firewall.

Example


oServer := TsgcWebSocketServer.Create(nil);
oServer.Firewall := oFirewall;
oServer.Active := true;

Back to Properties