My twitch plays bot keeps disconnecting from twitch

i have a custom twitch plays bot that me and a friend did works amazing. https://github.com/deeredman1991/Twitch-Plays-Bot but if i have it running all day it will randomly disconnect from chat and we can not work out what the bug is
it is a Python bot that runs twitch plays kindom harts. But this bug makes it hard to keep the stream up and have cmds working

The edge servers do sometimes restart and occasional connection problems aren’t exactly rare either. Your bot should detect when the connection is closed and reconnect on its own.

1 Like

so how would we implement something like that if we do not have it

Most IRC libraries will have some way to handle a connection disconnection.

We use DNS to point at an AWS elastic load balancer. At this point we suspect that these disconnection events are due to ELB instances changing IP addresses. When an IP address changes, clients are disconnected. This is a (unfortunately) well documented issue:


The recommendation is to handle disconnections as @3ventic mentions.

You could also periodically tear down & rebuild a connection, but that is generally unnecessary. We’re investigating more tracking of when this happens on our end, so we can understand it better.

Always appreciate data dumps (with timestamps) from you guys if you see something like this so we can correlate it with our own metrics!

2 Likes

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