diff --git a/api/websocket_handler.go b/api/websocket_handler.go index 234c32b..a7a570b 100644 --- a/api/websocket_handler.go +++ b/api/websocket_handler.go @@ -151,8 +151,17 @@ func (h *APIHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request) { }() for { + _, msg, err := conn.ReadMessage() if err != nil { + if websocket.IsCloseError(err, websocket.CloseNormalClosure) { + fmt.Println("Client closed connection") + break + } else if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) { + fmt.Println("Client closed connection unexpectedly") + break + } + fmt.Println("Error reading message:", err) break } diff --git a/go.mod b/go.mod index 9058464..e711239 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( ) require ( - github.com/erigontech/erigonwatch v0.1.24 + github.com/erigontech/erigonwatch v0.1.25 github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index ef66603..e5b8659 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/erigontech/erigonwatch v0.1.24 h1:o0Smm0IUg8Ak8sfo0BKht/jos8N9ht8wwqXJ13F5H0k= -github.com/erigontech/erigonwatch v0.1.24/go.mod h1:8vQ+VjvLu2gkPs8EwdPrOTAAo++WuLuBi54N7NuAF0I= +github.com/erigontech/erigonwatch v0.1.25 h1:NRCwI6Np4XHVoL/vfPoFH9cphqIAAtWkXArN+is5Cjs= +github.com/erigontech/erigonwatch v0.1.25/go.mod h1:8vQ+VjvLu2gkPs8EwdPrOTAAo++WuLuBi54N7NuAF0I= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=