From c3085ea7f98e7c895ca6645b48d344a255479c46 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 23 Mar 2024 12:03:39 +0100 Subject: [PATCH] [eventsub] Suppress error on abnormal closure and reconnect Signed-off-by: Knut Ahlers --- pkg/twitch/eventsubWebsocketClient.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/twitch/eventsubWebsocketClient.go b/pkg/twitch/eventsubWebsocketClient.go index 13a4f8d..ffc04d6 100644 --- a/pkg/twitch/eventsubWebsocketClient.go +++ b/pkg/twitch/eventsubWebsocketClient.go @@ -385,6 +385,10 @@ func (e *EventSubSocketClient) handleSocketError(err error, msgC chan eventSubSo e.logger.Debug("websocket was closed normally") return nil + case websocket.CloseAbnormalClosure: + e.logger.Warn("websocket reported abnormal closure") + return errors.Wrap(e.connect(e.socketDest, msgC, errC, "network-error"), "re-connecting after abnormal closure") + default: // Some non-twitch close code we did not expect e.logger.WithError(closeErr).Error("websocket reported unexpected error code")