Specifying a 5 seconds timeout on both the read and write operations when creating the websocket client
This commit is contained in:
parent
84515d5296
commit
2e909a02f1
1 changed files with 2 additions and 0 deletions
|
@ -223,6 +223,8 @@ public class NetworkService extends Service {
|
||||||
OkHttpClient client = new OkHttpClient
|
OkHttpClient client = new OkHttpClient
|
||||||
.Builder()
|
.Builder()
|
||||||
.connectTimeout(2, TimeUnit.SECONDS)
|
.connectTimeout(2, TimeUnit.SECONDS)
|
||||||
|
.readTimeout(5, TimeUnit.SECONDS)
|
||||||
|
.writeTimeout(5, TimeUnit.SECONDS)
|
||||||
.build();
|
.build();
|
||||||
mSelectedNode = nodeProvider.getBestNode();
|
mSelectedNode = nodeProvider.getBestNode();
|
||||||
Log.v(TAG,"connect.url: "+ mSelectedNode.getUrl()+", latency: "+mSelectedNode.getLatencyValue());
|
Log.v(TAG,"connect.url: "+ mSelectedNode.getUrl()+", latency: "+mSelectedNode.getLatencyValue());
|
||||||
|
|
Loading…
Reference in a new issue