From 34d4206f65cea637b3c8a04f23ea62c7b916a167 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Sun, 27 Oct 2024 16:46:11 +0100 Subject: [PATCH] fix: use `websocket` constant to check `IsCloseError` --- internal/websocket/receive.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/websocket/receive.go b/internal/websocket/receive.go index dbce35f..3e96ca9 100644 --- a/internal/websocket/receive.go +++ b/internal/websocket/receive.go @@ -19,7 +19,7 @@ func ProcessServerMessages(conn *websocket.Conn, channel chan<- GoTomato.ServerM for { _, message, err := conn.ReadMessage() if err != nil { - if websocket.IsCloseError(err, 1000) { + if websocket.IsCloseError(err, websocket.CloseNormalClosure) { // Ignore normal closure and exit gracefully return } @@ -36,7 +36,5 @@ func ProcessServerMessages(conn *websocket.Conn, channel chan<- GoTomato.ServerM } channel <- serverMessage - channel <- serverMessage } - }