robotty / dank-twitch-irc

Connect to Twitch chat from Node.js
https://www.npmjs.com/package/dank-twitch-irc
MIT License
88 stars 25 forks source link

Load-based scaling #194

Open RAnders00 opened 3 years ago

RAnders00 commented 3 years ago

Create new connections when lots of messages need to be sent

5E7EN commented 3 years ago

Is this in order to sent messages faster than the default Twitch enforced interval of 100ms by distributing the messages across multiple connections? Why can't messages just be queued on a single connection?

RAnders00 commented 3 years ago

Yes, it's a thing larger bots might work if they consistently have to send messages faster than 100ms intervals. The messages could back up faster than they can be sent. This also seems useful for usages like mass-banning bots or similar.

5E7EN commented 3 years ago

This is a fair request, however there's one main issue I've experienced in the past while working with similar configurations - and that is, messages being sent out of order (which I assume is because of clients fluctuating in latency; along with not actually confirming message delivery) - as seen here: https://i.imgur.com/qaNe9JN.gif (supposed 10-width pyramid).

TroyKomodo commented 3 years ago

@5E7EN @RAnders00 Perhaps creating message groups where messages within the group must be processed on a single connection and then create a connection if no connection can support the size of the group? Solves the out of order issue as you could then just wrap all the messages that need to be sent in order in a MessageGroup.