Somewhat random IRC disconnection

I use a library in C# called IrcDotNet to connect to the twitch IRC, everything works (Login, sending and receiving messages) until something (I don’t know what) seems to disconnect the client.

The Disconnected event doesn’t get called and no data is transfered!

I have noticed that this happens after around 3-5 minutes, but I can’t seem to find the cause. Is there something I’m missing? PING requests are supposedly answered by the library’s code, but maybe it’s doing it wrong? I’m lost!

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.