To avoid any confusion about terminology used, the number of clients that can be attached and subscribed to a channel is unlimited. See the channel pub/sub documentation for more info on attaching and subscribing without limits.
This article addresses the limits that exist for members that can use the presence feature to be present on a channel. See the presence documentation for more info on using presence.
The limits we impose for max members on a channel are in fact largely not driven by constraints within the Ably platform, but are instead there as a precaution for customers who want to have very large presence sets and may not realise the implications of this.
In order to understand why we impose limits, it's important to see what happens when members enter or leave presence on a channel. Take the following example:
- The first user enters the channel, as they are the only person on the channel only one enter event is emitted back to the user. This counts as a total of 2 messages, one presence publish, one presence subscribe.
- The second user enters and publishes their presence, and two users (that includes the second user) receive the event, this counts as 3 messages.
- Assuming this pattern continues and 1,000 users enter the channel, at this point 1,000 enter events would have been published, 501,000 enter events would have been received!
- Assuming then all users left, 1,000 leave events would be published and another 501,000 leave events would have been received.
- Do all members present need to subscribe to presence events as well? If not, then the problem effectively goes away as 1,000 users entering and leaving only generates 2,000 events. We recommend you achieve this by simply removing the subscribe capability for those users on that channel using token authentication. You could use the realtime API to subscribe to the presence set from your server or use the REST API presence features to periodically get the members present on a channel.
- Are you happy to consume this many messages to support these large presence member sets? If so, get in touch to discuss increasing the max members present on a channel.
If you want to increase the max members on a channel, please get in touch