diff --git a/rpc/json/ws.go b/rpc/json/ws.go index d9b194ccb..a086ba980 100644 --- a/rpc/json/ws.go +++ b/rpc/json/ws.go @@ -8,7 +8,6 @@ import ( "time" "github.com/gorilla/websocket" - tmpubsub "github.com/tendermint/tendermint/libs/pubsub" "github.com/dymensionxyz/dymint/types" @@ -79,13 +78,13 @@ func (h *handler) wsHandler(w http.ResponseWriter, r *http.Request) { if err != nil { if _, ok := err.(*websocket.CloseError); ok { h.logger.Debug("WebSocket connection closed", "reason", err) - err := h.srv.client.EventBus.UnsubscribeAll(r.Context(), remoteAddr) - if err != nil && !errors.Is(err, tmpubsub.ErrSubscriptionNotFound) { - h.logger.Error("unsubscribe addr from events", "addr", remoteAddr, "err", err) - } } else { h.logger.Error("read next WebSocket message", "error", err) } + err := h.srv.client.EventBus.UnsubscribeAll(r.Context(), remoteAddr) + if err != nil && !errors.Is(err, tmpubsub.ErrSubscriptionNotFound) { + h.logger.Error("unsubscribe addr from events", "addr", remoteAddr, "err", err) + } break }