Get some logs of the raw data being transferred between you and Twitch, and analyze what’s going wrong, if anything. Twitch usually kicks you off for not responding to PINGs, but I’m not sure of the exact window on when that occurs. There’s also other factors that can play into socket disconnection, including the breaking of rate limits and even networking issues such as packet loss.