Closed csquan closed 1 week ago
func WsUserDataServe(listenKey string, handler WsUserDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error) { endpoint := fmt.Sprintf("%s/%s", getWsEndpoint(), listenKey) cfg := newWsConfig(endpoint) wsHandler := func(message []byte) { event := new(WsUserDataEvent) err := json.Unmarshal(message, event) if err != nil { errHandler(err) //here error happen return } handler(event) } return wsServe(cfg, wsHandler, errHandler) }
when key expired,message:{"e": "listenKeyExpired","E": "1699520437418","listenKey": "eKCFWuorbdKFRW27XzMmVva76epP8F2zSpPrQTlXESDBsQAXFHennNf3A7GsyCqT"} then json.Unmarshal(message, event) error
binance api problem:
{"e": "listenKeyExpired","E": "1699520437418","listenKey": "eKCFWuorbdKFRW27XzMmVva76epP8F2zSpPrQTlXESDBsQAXFHennNf3A7GsyCqT"}
{"e":"ORDER_TRADE_UPDATE","T":1699521504258,"E":1699521504260,"o":{"s":"DOGEUSDT","c":"ios_bdoSoCTJC3xJ5mpHM8BK","S":"SELL","o":"LIMIT","f":"GTC","q":"131","p":"0.610000","ap":"0","sp":"0","x":"NEW","X":"NEW","i":34611865748,"l":"0","z":"0","L":"0","n":"0","N":"USDT","T":1699521504258,"t":0,"b":"0","a":"229.188000","m":false,"R":false,"wt":"CONTRACT_PRICE","ot":"LIMIT","ps":"SHORT","cp":false,"rp":"0","pP":false,"si":0,"ss":0,"V":"NONE","pm":"NONE","gtd":0}}
which you would see type of E is different.
it looks like binance should set E to number when the listenKey expires.is this case still happens?
it looks like binance should set E to number when the listenKey expires.is this case still happens?
Yes I faced the same issue at yesterday. So the problem still is continue
completed, close this issue.
when listenKey expired get error:json: cannot unmarshal string into Go struct field WsUserDataEvent.E of type int64? about an hour,which code should like this :
doneC, stopC, err := futures.WsUserDataServe(listenKey, func(event *futures.WsUserDataEvent) { logrus.Info("****receive followed order data:") logrus.Info(event) switch event.Event { case "ORDER_TRADE_UPDATE":
//when listenKey expired,get error:json: cannot unmarshal string into Go struct field WsUserDataEvent.E of type int64 logrus.Error(err) }) see above code ,what happned?