https://kotlinlang.org logo
#android
Title
# android
b

blakelee

06/21/2019, 5:43 PM
Anyone happen to know if Retrofit 2.6.0 uses Dispatchers.IO by default with coroutines?
g

gildor

06/21/2019, 5:45 PM
No, it uses built in OkHttp dispatcher (not coroutine, OkHttp abstraction on top of threadpool), same way as it happens with defaul async Retrofit API (retrofit2.Call class)
b

blakelee

06/21/2019, 5:45 PM
But it’s not main thread which is what’s important
g

gildor

06/21/2019, 5:45 PM
No, same way as request started using enque method of Call
This is actually default behavior for any coroutine adapter for callbacks, it has nothing to do with dispatchers, just wrap some callback to coroutine using Continuation by calling continuation.resume() from callback
It also the same behavior that would you have with RxJava asyncronous adapter for Retrofit
2 Views