Skip to main content

BINANCE_WS_SUBSCRIPTION_QUOTA

Static BINANCE_WS_SUBSCRIPTION_QUOTA 

Source
pub static BINANCE_WS_SUBSCRIPTION_QUOTA: LazyLock<Quota>
Expand description

WebSocket subscription rate limit: one message per 300 ms with no burst.

Binance limits incoming WebSocket messages (subscribe/unsubscribe) to 5 per second and closes the connection with code 1008 (“Too many requests”) when that is exceeded. A Quota::per_second(5) token bucket allows a burst of 5 followed by one refill every 200 ms, so up to 9 messages can land within the first rolling second and trip the limit. A fixed 300 ms period (about 3.3 messages per second) spaces every message evenly and stays under the venue limit with headroom.