I’ve reviewed my log file after a recent outage and I noticed that my bot disconnected from 165 of the connections that it holds to the Twitch chat servers. I believe that the root of the problem is that I am not handling the RECONNECT command correctly and that I am trying to reconnect these connections too quickly.
I have a few questions that will help me to resolve this.
The first question: what is the exact format of a RECONNECT message? I notice in the IRC documentation that messages such as ROOMSTATE, USERSTATE, etc. have examples, but there is no example for RECONNECT. My logs do not show any RECONNECT messages, possibly because my parser crashes when parsing RECONNECT messages. I will correct the parser to log messages that it cannot parse, but if someone can enlighten me to the format of a RECONNECT message, then it will save me a deployment.
The second question: are RECONNECT messages jitterred so that I do not receive them all at once? If not, then I will have to build in my own jittering so that I do not reconnect all at once.