Best way to detect D/C?

It is known now that chat bot still gets disconnected even when you properly response to PINGs with PONGs, Since TMI servers sometimes are being restarted on the twitch side. Disconnects tend to happen every 4-5 days.

What is the best and proper way for chat-bot to detect D/C?

  1. By sending PING to TMI and waiting for PONG? (Does TMI server answer to that?).
  2. Inactivity. But what if stream is offline and nothing happens in chat? This would raise unwanted bot restarts and creates empty windows when bot can not response.
  3. detect disconnect?
  4. Make timer() and restart every 24 hour? But do I need to do that that often if bot sometimes may work fine for 3+ days? What if bot gets D/C in few hours, he may be unavailable for half a day.

p.s: and how do I properly restart connection? :stuck_out_tongue: I use Python

I can’t speak to how works, but in my client I use a combination of 1 and 2: Only if there is inactivity it will send a PING to the server to check if the inactivity is caused by a disconnect. When there is any kind of traffic on the connection there’s no reason to check. The server does answer to PINGs, although even if it wouldn’t, just trying to send something on the socket usually shows that it’s no longer connected (at least for what I’ve been using in Java).

1 Like

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