pyTwitchAPI
pyTwitchAPI copied to clipboard
EventSub Websocket failing to reconnect
For some people, EventSub Websocket seems to fail to reconnect from time to time.
Log:
2024-01-18 21:22:35,147 - got session keep alive
2024-01-18 21:22:45,146 - got session keep alive
2024-01-18 21:22:54,675 - got request from websocket to reconnect
2024-01-18 21:22:54,675 - reconnecting using wss://cell-c.eventsub.wss.twitch.tv/ws?challenge=123dd623-5b4c-4af7-9372-5b6ed985c123&id=123oQokjpezENRQC9qSpqX-bPKBIGY2Vsb123...
2024-01-18 21:22:54,675 - websocket is closing
2024-01-18 21:22:54,828 - Websocket closing: 4007 - Invalid reconnect
@Teekeks Do you think this will fix #291
Do you think this will fix #291
No, because that issue is talking about a network glitch on the client side, whereas this issue is coming from an problem with how the library is handling a session_reconnect message from Twitch.
ws_test.txt I've created a test file to reproduce this issue. With this file I saw the issue in the logs here:
2024-05-28 10:31:20,607 DEBUG twitchAPI.eventsub.websocket got session keep alive
2024-05-28 10:31:30,606 DEBUG twitchAPI.eventsub.websocket got session keep alive
2024-05-28 10:31:36,593 DEBUG twitchAPI.eventsub.websocket got request from websocket to reconnect
2024-05-28 10:31:36,594 DEBUG twitchAPI.eventsub.websocket reconnecting using wss://cell-a.eventsub.wss.twitch.tv/ws?challenge=f522781c-154f-4988-8098-a278919d332c&id=AgoQgTr-_hg5ST6DQGlKRLFU6BIGY2VsbC1h...
2024-05-28 10:31:36,632 DEBUG twitchAPI.eventsub.websocket websocket is closing
2024-05-28 10:31:36,740 INFO twitchAPI.eventsub.websocket Websocket closing: 4007 - Invalid reconnect
2024-05-28 10:58:44,100 DEBUG twitchAPI.eventsub.websocket stopping websocket EventSub...
Using the same repro file to test my fix that I'll open a PR for shortly