TsgcWebSocketServerProperties › RateLimiter

RateLimiter Property

Assigns a rate-limiter component that caps request and message rates per client or per IP.

Syntax

property RateLimiter: TsgcWSRateLimiter read FRateLimiter write SetRateLimiter;

Default Value

nil

Remarks

Drop a TsgcWebSocketRateLimiter on the form and assign it to RateLimiter to enforce per-peer throttling policies (requests per minute, messages per second, etc.) defined on the rate-limiter component. When a peer exceeds its quota the rate limiter closes or rejects the offending connection according to the configured policy. This property is compiled only when the SGC_RATELIMITER conditional is defined. Use together with Firewall and Throttle for a layered protection strategy.

Example


oServer := TsgcWebSocketServer.Create(nil);
oServer.RateLimiter := oRateLimiter;
oServer.Active := true;

Back to Properties