binance-connector-java icon indicating copy to clipboard operation
binance-connector-java copied to clipboard

feat: change web socket ping interval duration

Open mahbodsn opened this issue 2 years ago • 7 comments

mahbodsn avatar Aug 02 '22 09:08 mahbodsn

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mahbodsn

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

bnbot avatar Aug 02 '22 09:08 bnbot

What is the reason behind for adding pingInterval?

chairz avatar Aug 11 '22 02:08 chairz

What is the reason behind for adding pingInterval?

The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed.

according to Binance documentation pingInterval should set every 3 minutes.

mahbodsn avatar Aug 12 '22 09:08 mahbodsn

@chairz

mahbodsn avatar Aug 18 '22 08:08 mahbodsn

The server will send a ping frame. The client just have to reply with a pong. The pong reply is handled by the websocket library. You can test the websocket example files, it should run more than 3 minutes which also means that the ping-pong is handled correctly.

chairz avatar Aug 18 '22 08:08 chairz

The server will send a ping frame. The client just have to reply with a pong. The pong reply is handled by the websocket library. You can test the websocket example files, it should run more than 3 minutes which also means that the ping-pong is handled correctly.

Hi, in my tests when you don't set ping interval explicitly socket connections drop after 3 minutes.

mahbodsn avatar Aug 18 '22 08:08 mahbodsn

I have tested it on my end and data is still pushing through after 5 minutes. Please provide your test file along with pom.xml

chairz avatar Aug 18 '22 09:08 chairz

https://github.com/square/okhttp/issues/5833 https://github.com/square/okhttp/pull/6730

You can take a look at these 2 links to understand more about it. tldr: OKHTTP does manages ping frame internally and replies with a pong.

chairz avatar Aug 18 '22 10:08 chairz

Hi @mahbodsn, we're closing the PR as so far it doesn't seem to be an issue with this project directly and there's has not been new complains.

aisling-2 avatar Sep 10 '22 14:09 aisling-2