1

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?

1 Answer 1

2

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.