Help Wizard

Step 1

NEXT STEP

Reconnect strategy too conservative

Reconnect strategy too conservative

I've posted this in the iOS section, but should be in the Android.

 

On the Galaxy S4, when driving in the car the internet connection will briefly go and come back almost every minute. Spotify's reconnect strategy is way too conservative now, the application just freezes (except for the offline playlist,) until I kill and restart it. After than it's working again for a minute or so. (But my shoutcast radio app is working fine most of the time.)

After a connection reset or requested data not getting there within a certain time, Spotify should use a smarter reconnect strategy using different time-out values depending on the network type and number of retries. (Using tiny ping packets first, not the whole request block) On a GPRS network getting a response can take a long time if you get it at all. On HSPDA or LTE the response should be there relativly fast, when it's not you can give up and retry much faster. In the Android API you can get the network type using TeleponyManager.getNetworkType(). It may also be helpful if Spotify would learn what the connection times are with the user's provider for each netwerk type to be able to get the timeout values right. If I were the programmer I would probably experiment with two looping connection threads with different sockets, one with a short time-out and one with a longer. The first one successful will become the active one the other discarded.  But on a very slow network that may not work. But I think the key is probing the connection first with tiny ping packets before sending a full request, opposed to having the risk of sending a full request multiple times which clog the line if the full responses come late, but multiple times. Another strategy could be requesting small pieces of data from different sections of the audio timeline or playlists. Then when sucessful try requesting bigger pieces until the connection breaks again. This way the traffic for probing connection is utillized.

Reply
0 Replies

Suggested posts