If your app dashboard shows you have a higher than expected number of peak connections, then we recommend you consider all of the following that could be contributing to this problem:
- Are you using a Realtime library server-side when you should in fact be using a REST library? If you use a Realtime library from your servers, then you must be aware that ever time the library is instanced a connection is established to Ably and will not be disconnected unless you explicitly close the connection. See the section "When to use Realtime vs REST libraries" in the Realtime overview documentation for a more detailed explanation.
- Are you accidentally instantiating the Realtime client library multiple times in one page or app? You should only use a single instance of the realtime library per page/app, else each instance, unaware of the other, will maintain its own connection to Ably.
- Are you aware that browser tabs are completely sandboxed from each other for security reasons and as such connections cannot be shared? If you are instancing a Realtime library in a browser, there will be one realtime connection per open tab. See the support article "Can a single connection be shared across multiple browser tabs?"
- If you are unclear how connections our counted, please see support article "How does Ably count peak connections?"
- Note that a connection that is abruptly disconnected is maintained by Ably for up to two minutes, so if you frequently refresh your browser and don't explicitly close the connection or resume / recover your connection, you could quickly increase the peak connections. See the section "Abrupt disconnections and page reloads" in the support article "How does Ably count peak connections?".
If none of the above helps resolve the unexpected high connection count, we recommend you first:
- Use the developer console and monitor the connections being opened in realtime. This should help you identify the source of new connections.
- Contact us with the necessary information we need to help us resolve your issue.
Finally, please note that if you significantly exceed your paid package limits or exceed your free package limits, we may block your account. Find out more about what happens when you exceed limits.