Rate Limits
Mist enforces the following limits per API token:
| Limit | Value |
|---|---|
| WebSocket connections per hour | 2,000 |
| Channels per connection | 2,000 |
Exceeding either limit can result in 429 responses during connect/subscribe flows and may trigger connection drops.
## Distribute Channels Across Multiple Connections
Never subscribe to thousands of channels on a single WebSocket. A single connection with too many channels means:
- A single point of failure for all your data
- Message backlog builds faster than it can drain
- Higher risk of hitting the 2,000 channel limit
❌ Bad — 2000 sites, 1 WebSocket, 2000 channels:
ws://api-ws.mist.com → /sites/site_1/stats/devices
→ /sites/site_2/stats/devices
→ ... (2000 channels)✅ Good — 2000 sites, 30 WebSockets, ~70 channels each:
ws_1 → /sites/site_1/stats/devices ... /sites/site_70/stats/devices
ws_2 → /sites/site_71/stats/devices ... /sites/site_140/stats/devices
...
ws_30 → /sites/site_1931/stats/devices ... /sites/site_2000/stats/devicesThis also gives you natural parallelism and resilience — a single dropped connection only affects a subset of your data.
Handle 429 Responses
Your reconnect logic must handle rate limit responses gracefully. If you receive a 429, back off before reconnecting — reconnecting immediately will just hit the limit again:
RECONNECT_DELAY = 5 # seconds, increase if hitting 429 frequently
def on_close(ws, code, msg):
logger.info(f"WebSocket closed — code: {code}, msg: {msg}")
if __name__ == '__main__':
while True:
try:
establish_ws()
except Exception as e:
logger.error(f"Connection error: {e}")
time.sleep(RECONNECT_DELAY)Plan for Message Volume, Not Just Channel Count
The 2,000 channel limit is one constraint, but message volume per channel matters equally. A single site with thousands of clients can generate hundreds of messages per second on its own. If too many high-traffic channels are on one connection, the receive buffer fills up and starves the ping/pong mechanism — even if you're well under the channel limit.
Before finalizing your subscription layout:
- Estimate the total message rate across all channels on a single connection
- If you expect high traffic sites or large client counts, distribute aggressively — fewer channels per connection
- Monitor queue depth at runtime (see Message Throttling & Queue Monitoring) and rebalance if it grows unbounded
Need Higher Limits?
If your use case legitimately requires more than 2,000 connections/hour or 2,000 channels/connection, contact Mist support to request a limit increase.