TsgcWebSocketHTTPServer › 属性 › Throttle
限制服务器对每个连接读取或写入的带宽(位/秒)。
property Throttle: TsgcWSThrottle read GetThrottle write SetThrottle;
Enabled=False
当 Throttle.Enabled 为 True 时,服务器会限制每个连接的数据读写速率。可用于防止单个客户端占满上行带宽,或在开发过程中模拟低带宽场景。限速在套接字层应用,独立于 RateLimiter(限制请求/消息速率)和 MaxConnections(限制并发会话数)。
oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.Throttle.BitsPerSec := 65536;
oServer.Throttle.Enabled := true;
oServer.Active := true;