TsgcWebSocketFirewall › Methods › IsFrameSizeAllowed
Checks a single WebSocket frame size against WebSocketProtection.MaxFrameSize and returns whether it is within the configured limit.
function IsFrameSizeAllowed(aSize: Integer): Boolean;
| Name | Type | Description |
|---|---|---|
aSize | Integer | Size in bytes of the frame or message payload to validate. |
True if the frame size is within limits (or WebSocketProtection is disabled, or MaxFrameSize is 0 meaning "unlimited"); False when the frame exceeds the maximum. (Boolean)
This is one of three granular WebSocket handshake/frame helpers (IsOriginAllowed, IsFrameSizeAllowed, IsSubprotocolAllowed) that are normally invoked automatically by IsMessageAllowed and the server integration. Use IsFrameSizeAllowed directly when writing custom frame inspectors or validating buffered data before forwarding it to another subsystem.
if not sgcWebSocketFirewall1.IsFrameSizeAllowed(Length(aBytes)) then
raise Exception.Create('frame exceeds configured MaxFrameSize');