Why do you have a limit on the number of members present on a channel?

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.  
Therefore, in order to have 1,000 members on a channel present and also subscribed to presence, you should expect over 1m events to be received and 2k events to be published to facilitate that.  If all 1,000 users left over the space of 10 seconds, messages will be published at a rate of 50k per second!
Therefore, when considering channels with lots of members present, you need to consider:
  • 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), so we'd be happy to raise the limit for you if you're on a package with configurable limits. To stop some users being sent presence events, 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.


Next steps: