If you ever receive the following error message, it means you've hit your limit on channels per connection:
[ErrorInfo: Maximum number of channels per connection MAXCHANNELS exceeded; statusCode=90010; code=400]
Where MAXCHANNELS is the maximum number of channels per connection you're allowed.
This is to be expected if you're attempting to use more channels per connection than your limit allows. We impose a limit to ensure that the connection state and the load imposed for connection resumption don't become unbounded. With more channels on a single connection, the size of the connection state grows, as does the work required to resume or recover the connection if dropped, both for the client and the Ably server.
There are a few ways to avoid reaching your limit. If you're only using channels for a short period of time, make sure to detach them from the connection with channel#detach once you're done. Any attempt at publishing or subscribing to a channel will implicitly attach to it, so by detaching after these actions you can keep your channels per connection to a minimum.
If you are only publishing to a channel, and the rate at which you publish on a channel is low, you may wish to use REST publishes instead as they are stateless.
If you genuinely need to attach many hundreds of channels simultaneously with one client, you should consider sharding the channels across multiple connections. Otherwise, you are able to configure your limit with an Enterprise account.