Update: Improved chat server restarts

We plan on updating the Twitch clients to reconnect gracefully during restarts. We will publicize a guide for how this is accomplished so that bot developers can do the same.

From a high level, it will look something like this:

  • For clients which have registered for custom commands (IRC v3 capability negotiation), we will send a custom IRC command.
  • possibly similar to — :tmi.twitch.tv RECONNECT
  • The client will have some duration (30s possibly) to create a new connection and re-join their channels
  • To avoid missing any messages, clients will have to maintain old and new connections simultaneously for a brief period (a few secs after you’ve re-joined channels on the new connection). Clients will need to de-dupe messages while maintaining duplicate connections. After a brief period with duplicate connections receiving messages, the client can close the old connection (it will be forcefully closed on the server at some point)

Keep in mind this logic is subject to change, but that is likely to be how it works.

Another note, we’re actively working on creating chat-specific API documentation in the Twitch-API github repo, so expect some of that soon.