adshao / go-binance

A Go SDK for Binance API
MIT License
1.54k stars 677 forks source link

Data Unsubscribe #439

Closed git-yongge closed 3 months ago

git-yongge commented 1 year ago

How to subscribe and unsubscribe Binance Data push

tanakachitsamba commented 1 year ago

if I have got correct, what you mean. You would start a socket like the code I have shown before. you can send a stopC channel to stop the socket.

wsKlineHandler := func(event *binance.WsKlineEvent) {
    fmt.Println(event)
}
errHandler := func(err error) {
    fmt.Println(err)
}
doneC, _, err := binance.WsKlineServe("LTCBTC", "1m", wsKlineHandler, errHandler)
if err != nil {
    fmt.Println(err)
    return
}
<-doneC
git-yongge commented 1 year ago

Yes, I found out that stopC can be used to stop the socket, but my calling process is that the upper client calls my program, and then I call adshao to get the market data of Binance. If the client needs to stop the push of certain data, then There is no way to stop the last request sent, this is giving me a headache, please help me.

xyq-c-cpp commented 3 months ago

No response for a long time, close this issue