Incoming chat message que maximums

We are building a “large” chat bot. The bot has been verified.

When the queue of messages sent from Twitch to our bot exceeds Twitch’s buffer you reach a message que maximum and your bot is DC’d.

I read from a related post:

Large chat bots will often split groups of channels over multiple connections to solve this issue.

Trying to understand what the recommended solution is.

  • Do we instantiate multiple TMI clients using the same credentials and shard channels over those clients? For example:
let credentials = { identity: { username: 'user123', password: 'pass456' }}
let client1 = new tmi.client(credentials)
let client2 = new tmi.client(credentials)
client1.join('#foo')
client2.join('#bar')
  • Does each constructor return a unique connection with it’s own incoming message queue buffer or is the buffer shared between the two. Is the buffer throttled at the account level or at the connection level?

  • Are there limitations to how many TMI clients are instantiated from a single server using the same credentials?

Thanks

Yes

Each connectiong will recieve the messages for the rooms that that connection has JOINed

So
Connection 1 in rooms foo and bar
Connection 2 in rooms cake and pie
Connection 3 in rooms cake and lemon

Connection 2 will not recieved messages from foo and bar.
Connection 2 and 3 will recieved messages for cake as both connections are in cake
Connection 3 will get lemon but not pie.

So

Yes.

Then it’s just down to what the server can handle in terms of traffic not just the given process keeping up.

Broadly speaking:

Rate limit is by “IP” so you have a shared rate limit across all the connections from the same server, broadly speaking.

Discussing rate limit can get complicated very quickly.

Excellent. Thanks for this information. Follow up questions:

  • What is the available bandwidth for a given incoming message buffer per connection? How do I measure it or see it’s current capacity?

  • Are there any metrics that can be used after connecting to a channel to determine what bandwidth it will consume?

What I’d like to do is programmatically determine capacity for a given connection to move channels around and spin up new clients to stay under.

Thanks

It’s more a question or your ability to keep up.

The docs do not cover a limit and there is no way to monitor/know the limit.

You can count the chat messages incoming I suppose.
But otherwise nope.

You can devise your own method and see what works best for you and your setup.

Theres no “good” rule of thumb for it