From ad75b64f408c51c41b2d7544d67e3e3fcbd05f7d Mon Sep 17 00:00:00 2001 From: Artem Skriabin Date: Thu, 17 Oct 2024 15:09:33 +0300 Subject: [PATCH] Fix parsing connection id --- ethermint/rpc/websockets.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ethermint/rpc/websockets.go b/ethermint/rpc/websockets.go index 8f1c1e20..a6c87ea4 100644 --- a/ethermint/rpc/websockets.go +++ b/ethermint/rpc/websockets.go @@ -24,6 +24,7 @@ import ( "math/big" "net" "net/http" + "strconv" "sync" "github.com/cosmos/cosmos-sdk/client" @@ -225,8 +226,16 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) { continue } - connID, ok := msg["id"].(float64) - if !ok { + var connID float64 + switch id := msg["id"].(type) { + case string: + connID, err = strconv.ParseFloat(id, 64) + case float64: + connID = id + default: + err = fmt.Errorf("unknown type") + } + if err != nil { s.sendErrResponse( wsConn, fmt.Errorf("invalid type for connection ID: %T", msg["id"]).Error(),