51201: Twilsock : CPS, Init per Account
CONVERSATIONS
ERROR
This error occurs when your account sends too many new or re-established Twilsock connection requests in a short period. For Conversations (classic) SDK connections, Twilio applies connection-establishment limits per subaccount and across the account overall.
- Your application is creating or re-establishing SDK connections fast enough to exceed the allowed rate of connection establishment for the account or subaccount.
- Your client code is repeatedly shutting down and recreating the SDK client during temporary network loss or when the app moves between background and foreground states. The SDK reconnects automatically in those cases.
- Your access token is expiring before you renew it, which disconnects the client and can trigger a burst of new client initializations.
- A large number of clients are reconnecting at the same time across one or more subaccounts, which pushes the shared account-wide connection rate over the limit.
- Reuse an existing SDK client for the signed-in user session when possible. Do not implement a shutdown and recreate cycle for normal network drops or app background and foreground transitions.
- Renew the access token before it expires. Handle
tokenAboutToExpireand callupdateTokenso the client can re-register without forcing a new client initialization. - If the token has already expired, request a fresh token and then create a new client once, instead of retrying repeated client creation attempts in a tight loop.
- Listen for
connectionStateChangedand your platform's SDK error callbacks so you can detect offline or denied states and avoid sending more connection attempts while the client is not ready. - Spread out bulk sign-ins, reconnects, or restart events so new SDK connections stay within the documented connection-establishment limits for your account and subaccounts.
- Check the Console Debugger and Error Logs to confirm when the limit is hit and identify the part of your application that is generating the connection burst.