fix: use websocket constant to check IsCloseError

This commit is contained in:
Sebastian Mark 2024-10-27 16:46:11 +01:00
parent f54e8486f1
commit 34d4206f65

View file

@ -19,7 +19,7 @@ func ProcessServerMessages(conn *websocket.Conn, channel chan<- GoTomato.ServerM
for { for {
_, message, err := conn.ReadMessage() _, message, err := conn.ReadMessage()
if err != nil { if err != nil {
if websocket.IsCloseError(err, 1000) { if websocket.IsCloseError(err, websocket.CloseNormalClosure) {
// Ignore normal closure and exit gracefully // Ignore normal closure and exit gracefully
return return
} }
@ -36,7 +36,5 @@ func ProcessServerMessages(conn *websocket.Conn, channel chan<- GoTomato.ServerM
} }
channel <- serverMessage channel <- serverMessage
channel <- serverMessage
} }
} }