[ResponseHandler] OKHTTP Error: interrupted

Hello!

I’m using some methods from Futures API like .market().tickerSymbol(parameters), .account().positionInformation(parameters). Everything seems to be perfect until they do not exceed 24 hours of functionality. If I use them for more than 24h the following exception is thrown: [ResponseHandler] OKHTTP Error: interrupted.

I use:

java version “17.0.5” 2022-10-18 LTS

groupId: com.squareup.okhttp3
artifactId: okhttp
version: 4.9.2

groupId: com.squareup.okhttp3
artifactId: mockwebserver
version: 4.9.1
scope: test

groupId: io.github.binance
artifactId: binance-futures-connector-java
version: 3.0.0

Does anyone have any idea what could be the problem?
Thank you!

which library are you using?

I’m using binance-futures-connector-java

Hi,

The endpoints you’re referring to are REST API endpoints which usually wouldn’t be constantly connected for a period of 24hrs, so when you say 24 hours of functionality what exactly do you mean by that? Consistently calling the endpoints in a loop for a period of 24 hours? Perhaps you’re getting rate limited or losing network connection? A websocket stream subscription is only valid for 24 hours for example.

Yes, If you’re consistently calling the endpoints in a loop for a period longer than 24 hours you will get that exception.

Is there a good solution to this problem? I’m using the same library as the author.

Calling the endpoints in a loop is not a good idea.
A potential solution would be to use websocket stream subscription. But make sure you re-create that connection before it expires.