Good day,
I am currently (and since a long time, actually) writting a bot for Twitch users, and so far so good. The only issue I actually get is that, knowing my application is using NodeJS, I need to try to write data to the socket to get either a timeout or a connectionClosed, as the setTimeout() would take into account data received only, not the fact that the socket wasn’t closed.
So, to be sure that my bot reconnects in case of error/timeout/non-response, I have to send a PING (and get a PONG) every minute to IRC Server, for each socket open (which is basically each channel the bot is on). Is there a better way to do, or is PING the only way to rely on an expected response from Twitch ? I don’t really want to send random data chunk and get a 421 UNKNOWN COMMAND error, as I fear being shadow-banned for too many invalid commands (?).
How would it be implemented, to get the least downtime/timed-out time for a bot, to understand he needs to reconnect ? Issue could either be a broken pipe, host server connection closed (or half-closed, enough for the bot to not get a “closed” event triggered), or even client server having a connection drop i.e. if my provider has some DDoS going on or network issues due to w/e reason.
Would doing a PING each minute fine ? It reduces by one my count of messages per 30s, but it isn’t really that big of a loss for small channels; Is there a better way to write data to the socket to be sure it’s alive ? Is there any echo command for Twitch IRC server ?
Sorry if it is quite broad, trying to be as clear as possible.
Have a great day and thanks in advance for the help !
Hugo