Retrofit by default is setting 10ms for timeout. The client is connected to services which are using webGates where the timeout is set 5ms. Wondering should on client side the timeout should be as much as the timeout of webGate or we should consider that we might have bad network and on client side we should set more then 5 ms?
Asked
Active
Viewed 424 times
1 Answers
1
add this to your code
val okHttpClient = OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.build()
and in you retrofit client add this
Retrofit.Builder()
.client(okHttpClient)
.baseUrl("YOUR BASE URL")
.addConverterFactory(GsonConverterFactory.create())
.build()

Ahmed Jamal
- 216
- 1
- 5