From 1b3a5b133802d2e706fff33da29fdfc32073679a Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 1 Sep 2024 11:49:08 +0200 Subject: [PATCH] Websocket: ignore upgrade errors --- server/socket.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/server/socket.go b/server/socket.go index cf48617226..69f2309cf6 100644 --- a/server/socket.go +++ b/server/socket.go @@ -2,7 +2,6 @@ package server import ( "context" - "errors" "net/http" "strings" "sync" @@ -65,17 +64,8 @@ func (h *SocketHub) ServeWebsocket(w http.ResponseWriter, r *http.Request) { } defer conn.Close(websocket.StatusInternalError, "") - err = h.subscribe(r.Context(), conn) - - if errors.Is(err, context.Canceled) { - return - } - if cs := websocket.CloseStatus(err); cs == websocket.StatusNormalClosure || cs == websocket.StatusGoingAway { - return - } - if err != nil { - log.ERROR.Println(err) - return + if err := h.subscribe(r.Context(), conn); err != nil { + log.TRACE.Println("web socket upgrade:", err) } }