Clarification of Rate Limits

As it said in Rare Limits section of user guide: a developer is allowed to send a certain number of commands to the server per second.
Is this restriction relates to one WebSocket connection to the server or number of commands counted in all developer’s connections?

The rate limit is per user. So if you have a bot called BotX, all connections by that bot will share the same rate limit. If you also have a BotY, that bot will have its own rate limits separate from BotX

Does Twitch has limits on number of channels per connection? Is there a rule of thumb for this number?

The limit is how many messages your client can handle before the message buffer fills, at which point Twitch will just kill the connection.

So if you’re in some of the most active channels on Twitch then you’ll be able to join fewer channels per connection than if most of the channels were idle, or active at different times of day.

If you want to really get the most out of each connection you could track usage and balance channels over connections but that’s really overkill, most devs just use limits between 50 to 200 channels per connection depending on the specific needs/capabilities of the bot.

Is there are any other reasons Twitch could close connection than exhausted buffers and rate limits?

Failure to ping/pong would also cause the connection to be dropped.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.