TsgcWebSocketFirewallProperties › WebSocketProtection

WebSocketProtection Property

WebSocket-specific validation for allowed origins, maximum frame size and allowed subprotocols.

Syntax

property WebSocketProtection: TsgcFirewallWebSocketProtection read FWebSocketProtection write SetWebSocketProtection;

Default Value

Remarks

Enable WebSocketProtection.Enabled to enforce WebSocket-layer rules during the handshake and frame processing. AllowedOrigins is a string list checked against the incoming Origin header; connections with a non-matching origin are rejected with violation type fvOrigin. MaxFrameSize caps the size of a single WebSocket frame in bytes and triggers violation type fvFrameSize (a value of 0 disables the check). AllowedSubprotocols restricts the values accepted during subprotocol negotiation. The runtime equivalents are exposed as IsOriginAllowed, IsFrameSizeAllowed and IsSubprotocolAllowed. Default: MaxFrameSize=0 (unlimited).

Example


sgcWebSocketFirewall1.WebSocketProtection.Enabled := True;
sgcWebSocketFirewall1.WebSocketProtection.AllowedOrigins.Add('https://www.esegece.com');
sgcWebSocketFirewall1.WebSocketProtection.MaxFrameSize := 65536;
sgcWebSocketFirewall1.WebSocketProtection.AllowedSubprotocols.Add('chat');

Back to Properties