Verified bot randomly disconnected


My chat bot is verified and connects to approximately 2500 channels on 1 websocket connection (I am using tmi.js, so one “client”) but I still get randomly disconnected without knowing why.

Is there a limit for reading messages on 1 connection ? I did not see any in the documentation.
Also is it recommended to use multiple websocket connections (so multiple tmi.js “clients”) when joining thousand of channels ?

Thank you,

Sounds like you hit the “send buffer got too full and your bot can’t keep up” limit.

It’s not documented, but if you can’t keep up you’ll get DC’ed

So you need to spread you channels across an extra instance or two as needed

Thank you for the prompt answer!

The “buffer” thing isn’t well documented, since when you get to the sort of scale where it becomes an issue, most people spin/spread their channels across instances for other/performance reasons anyway.

When you say “instances” you mean new machines or new websocket connections?
Do I need a different IP for each websocket connection?

Instances as in separate processes that make and handle their own connections to Twitch

@BarryCarlyon Do you have a rough idea of the maximum buffer size (messages received per seconds maybe) ?

Nope all I know is that it exists

You should establish one connection per about 20-40~ (afaik) channels, more than 100 channels is pretty much a guaranteed connection drop from my experience.

1 Like

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