Skip to content

Commit de7f932

Browse files
docs: add note about the readTimeout value
See also: socketio/engine.io-client-java@fb531fa
1 parent 98d0c13 commit de7f932

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/site/markdown/initialization.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ The [OkHttpClient instance](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-
272272

273273
```java
274274
OkHttpClient okHttpClient = new OkHttpClient.Builder()
275-
.readTimeout(1000, TimeUnit.MILLISECONDS)
276-
.writeTimeout(1000, TimeUnit.MILLISECONDS)
275+
.readTimeout(1, TimeUnit.MINUTES) // important for HTTP long-polling
277276
.build();
278277

279278
IO.Options options = new IO.Options();
@@ -421,6 +420,7 @@ sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
421420
OkHttpClient okHttpClient = new OkHttpClient.Builder()
422421
.hostnameVerifier(hostnameVerifier)
423422
.sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) tmf.getTrustManagers()[0])
423+
.readTimeout(1, TimeUnit.MINUTES) // important for HTTP long-polling
424424
.build();
425425

426426
IO.Options options = new IO.Options();
@@ -466,6 +466,7 @@ sslContext.init(null, new TrustManager[] { trustManager }, null);
466466
OkHttpClient okHttpClient = new OkHttpClient.Builder()
467467
.hostnameVerifier(hostnameVerifier)
468468
.sslSocketFactory(sslContext.getSocketFactory(), trustManager)
469+
.readTimeout(1, TimeUnit.MINUTES) // important for HTTP long-polling
469470
.build();
470471

471472
IO.Options options = new IO.Options();

0 commit comments

Comments
 (0)