Rate Limiter
TsgcWSRateLimiter — a full-featured rate limiting component that protects server endpoints from excessive traffic, abuse and scraping. Three algorithms, four scopes, long-term quotas and standards-compliant HTTP 429 responses.
TsgcWSRateLimiter — a full-featured rate limiting component that protects server endpoints from excessive traffic, abuse and scraping. Three algorithms, four scopes, long-term quotas and standards-compliant HTTP 429 responses.
Token-bucket rate limiter. Caps requests per second per client (or per IP) on any WebSocket or HTTP server you attach it to.
TsgcWSRateLimiter
Server-side admission control — attaches to any sgc server.
Windows, macOS, Linux, iOS, Android
Professional / Enterprise
Configure rate + burst, hook OnRateLimited, attach to your server.
uses
sgcWebSocket, sgcWebSocket_Server, sgcRateLimiter;
var
RL: TsgcWSRateLimiter;
WSServer: TsgcWebSocketHTTPServer;
begin
RL := TsgcWSRateLimiter.Create(nil);
RL.RequestsPerSecond := 20;
RL.BurstSize := 50;
RL.OnRateLimited := DoRateLimited;
WSServer := TsgcWebSocketHTTPServer.Create(nil);
WSServer.Port := 80;
WSServer.RateLimiter := RL;
WSServer.Active := True;
end;
13 published properties, 12 methods, 3 events — pulled from the component reference.
Published properties: Stats.
Properties: Enabled.
Properties: TokenBucket, SlidingWindow, FixedWindow.
Properties: PerIP, PerAPIKey, PerUser.
Properties: Response.
Properties: StorageFile.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Demo Project — 01.WebSocket\09.RateLimiter Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |