•Published: May 5, 2021
Recent updates to Stream Chat’s rate limiting behavior give dev teams greater flexibility and control to debug applications, combat malicious traffic, and monitor API usage for account billing purposes. These changes make it easier to avoid hitting rate limits in the first place, easier to recover if you do hit them, and easier to isolate rate limit issues to a specific platform if your application uses more than one Stream SDK. The updates are as follows:
- Stream Chat rate limits are now set only on a one-minute time window, decreasing the likelihood that abnormal usage events could stack up over a longer period and degrade performance or cause outages.
- Rate limits are now separated by platform SDK. In other words, if you have a web version of your app, an Android version, and an iOS version, and one of those three encounters a problem that causes it to hit rate limits, the other two will still function as normal. This can be especially helpful if a single app gets overwhelmed by malicious bot traffic or if that app contains a unique integration error.
- You can now inspect an app’s current rate limit quotas and usage directly in your Stream dashboard. Just select your app from the dropdown menu and navigate to Rate limits under Chat. You can also retrieve the API limits for your application using the API directly.
Learn more about Stream’s rate limits and review 6 top chat development and configuration best practices to avoid hitting them in our technical documentation→
Rate Limit Issues: Common Causes
Most rate limit issues trace back to one of two common causes: app abuse, as when bots sign up for thousands of accounts, or integration errors. Integration errors can include things like opening more than one websocket connection per user, running scripts that make too many API calls in rapid succession, or calling an endpoint like QueryChannels unnecessarily.
In both cases, Stream’s new rate limiting behavior is designed to help you identify and resolve problems early, with minimized disruption to your app’s performance. We highly recommend reading our rate limits documentation for more tips to optimize your app’s integration with regard to rate limits.
Why Rate Limits Matter
Stream is proud to set rate limits that make sense for our customers and still fall far below the maximum capacity of our system. Stream Chat is based on Go, RocksDB, and Raft, and it scales well to power some of the world’s largest sites and apps. Still, with infrastructure supporting chat and activity feeds for over a billion end users, it makes sense to set rate limits in order to:
- Maximize application performance. Whether caused by an integration issue or by abuse, excessive API calls also trigger client-side events that can easily degrade your app’s performance.
- Prevent integration issues or abuse from using more capacity than is provisioned for your plan. This protects Stream infrastructure.
- Identify integration issues — like opening more than one WebSocket for a single user — early, before impacts on cost or scale become a bigger problem. This is equally helpful if your application experiences abuse, as with bots generating users.
Benefits of Platform-Specific Rate Limits
With Stream Chat, different platforms such as iOS, Android, or your server-side infrastructure have independent counters for each API endpoint's rate limit. For example, The default connect endpoint limit is 10,000 per minute. If you've built an integration on iOS and Android, and 6,000 users connect in under a minute from iOS and another 6,000 connect from Android, you will not encounter a rate limit. Instead, you must see 10,001 users connect from just one platform, say iOS, in under a minute, to encounter a rate limit. Independent platforms have independent counters.
In the context of rate limits, Stream Chat supports four different types of platforms via our official SDKs:
- Server-side, like Go or Ruby clients. Requests that are not correctly detected end up on the same platform as the server side.
- Android, including Flutter and React Native for Android clients.
- iOS, including Swift, Flutter, and React Native for iOS clients.
Ongoing Stream Chat Improvements
These recent rate limit updates are part of an ongoing push to make Stream Chat the most developer-friendly in-app messaging solution available. That commitment includes additional dashboard improvements designed to make it easier to track API usage, understand your bill, and troubleshoot integration issues. If you haven’t already, check out our new historical usage charts, with MAU and concurrent connections visualized over time in your Stream dashboard.