Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binance.WebsocketTimeout = time.Second * 5 Not working ! #557

Open
QGB opened this issue Apr 24, 2024 · 3 comments
Open

binance.WebsocketTimeout = time.Second * 5 Not working ! #557

QGB opened this issue Apr 24, 2024 · 3 comments

Comments

@QGB
Copy link

QGB commented Apr 24, 2024

var symbols = []string{
"ETHBTC","LTCBTC","BNBBTC","NEOBTC","QTUMETH","EOSETH","SNTETH","BNTETH","GASBTC","BNBETH","BTCUSDT","ETHUSDT","LRCBTC","LRCETH","QTUMBTC","ZRXBTC","KNCBTC","IOTABTC", }

func main() {


	binance.WebsocketTimeout = time.Second * 5

     for _, symbol := range symbols {
		errHandler := func(err error) {
			fmt.Println("err",symbol,err)
		}

        doneC, _, err := binance.WsKlineServe(symbol, "1s", engk.Handle, errHandler)
        if err != nil {
            fmt.Println(time.Now().Format(time.RFC3339),"binance.WsKlineServe",symbol,err)
            // return
        }
        go func(c chan struct{}) {
            <-c
        }(doneC)
    }

// the log is
2024-04-24T08:05:57Z binance.WsKlineServe ETHBTC dial tcp 162.125.32.5:9443: i/o timeout
2024-04-24T08:06:42Z binance.WsKlineServe LTCBTC dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:07:27Z binance.WsKlineServe BNBBTC dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:08:12Z binance.WsKlineServe NEOBTC dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:08:57Z binance.WsKlineServe QTUMETH dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:09:42Z binance.WsKlineServe EOSETH dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:10:27Z binance.WsKlineServe SNTETH dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:11:12Z binance.WsKlineServe BNTETH dial tcp 202.53.137.209:9443: i/o timeout
2024-04-24T08:11:57Z binance.WsKlineServe GASBTC dial tcp 157.240.2.36:9443: i/o timeout
2024-04-24T08:12:42Z binance.WsKlineServe BNBETH dial tcp 157.240.2.36:9443: i/o timeout
2024-04-24T08:13:27Z binance.WsKlineServe BTCUSDT dial tcp 157.240.2.36:9443: i/o timeout


why the wait time more than  5 seconds ?




@xyq-c-cpp
Copy link
Collaborator

the default handshake timeout is 45 second, you can see this in code. binance.WebsocketTimeout is for ping and pong timeout.

@QGB
Copy link
Author

QGB commented Jun 20, 2024

How to change handshake timeout ?

@w3xyq
Copy link

w3xyq commented Jun 20, 2024

How to change handshake timeout ?

can't change, it is fixed in code. but do you really need to change the handshake timeout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants