How does OkHttp compare to Ktor Client? Seems they...
# coroutines
z
How does OkHttp compare to Ktor Client? Seems they land on similar use cases? Why might I prefer one over the other?
f
ktor is supported in Kotlin native projects. OkHttp has no support yet for kotlin-native projects.
Whether you want to prefer one over the other depends on your usecase/ project.
z
I'm just working on an Android app
Traditionally I've just always used OkHttp/retrofit
f
If you do not plan to share code with iOS using Kotlin multiplaftform modules, I will suggest you stick with okhttp/ retrofit because of a relatively better acceptability and usage. Ktor is a relatively new library and the support you may find for it in community pages is thin compared to okhttp/ retrofit combination.
c
Ktor HTTP client is mostly a wrapper over other platform-specific clients. You can use OkHttp as the engine for the Ktor client. As others mentioned, You probably wouldn’t benefit much from using just the Ktor client, but it’s most useful for making network requests from common code in a multiplatform app
👍 1
827 Views