From 388d160f2b0f52ec287c447ba993e4ab3ab5c8c1 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Mon, 15 Apr 2019 14:53:38 +1000 Subject: [PATCH] BTSE: Fix JSONDecode error upon successful websocket connection BTSE updated their websocket API to send a "connect success" message upon a successful connection --- exchanges/btse/btse_websocket.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exchanges/btse/btse_websocket.go b/exchanges/btse/btse_websocket.go index 351868bd..2e39b355 100644 --- a/exchanges/btse/btse_websocket.go +++ b/exchanges/btse/btse_websocket.go @@ -14,6 +14,7 @@ import ( "github.com/thrasher-/gocryptotrader/currency" exchange "github.com/thrasher-/gocryptotrader/exchanges" "github.com/thrasher-/gocryptotrader/exchanges/orderbook" + log "github.com/thrasher-/gocryptotrader/logger" ) const ( @@ -122,6 +123,14 @@ func (b *BTSE) WsHandleData() { ProductID string `json:"product_id"` } + if strings.Contains(string(resp.Raw), "connect success") { + if b.Verbose { + log.Debugf("%s websocket client successfully connected to %s", + b.Name, b.Websocket.GetWebsocketURL()) + } + continue + } + msgType := MsgType{} err = common.JSONDecode(resp.Raw, &msgType) if err != nil {