Monday, 2 July 2018

How To Write Retry Interceptor For Data Stream In OkHttp?

Or thinking the interceptor for this scenario applicable ?

Our app using OkHttp for downloading files (new version of app, daily databases etc.)

Sometimes server fails just while the app streaming bytes (btw the problem is, recvfrom failed: ECONNRESET)

So to fix this case i just wanted to write OkHttp retry interceptor. But seems this is appropriate for operations which aren't streaming.

Is there a solution(like interceptor) to handle this case ?


To make more clear exposition

0%==============================100% (Just started streaming)

0%==============================100% (10% completed)

0%==============================100% (20% completed)

0%==============================100% (ECONNRESET - Connection reset by peer)

At just this point, streaming gets stopped. The thing i'm wishing from OkHttp is recognizing this situation then starting the stream from scratch (not from 20%)



from How To Write Retry Interceptor For Data Stream In OkHttp?

No comments:

Post a Comment