Specifying a 5 seconds timeout on both the read and write operations when creating the websocket client

This commit is contained in:
Nelson R. Perez 2018-12-19 20:41:48 -05:00
parent 84515d5296
commit 2e909a02f1

View file

@ -223,6 +223,8 @@ public class NetworkService extends Service {
OkHttpClient client = new OkHttpClient
.Builder()
.connectTimeout(2, TimeUnit.SECONDS)
.readTimeout(5, TimeUnit.SECONDS)
.writeTimeout(5, TimeUnit.SECONDS)
.build();
mSelectedNode = nodeProvider.getBestNode();
Log.v(TAG,"connect.url: "+ mSelectedNode.getUrl()+", latency: "+mSelectedNode.getLatencyValue());