How does OkHttp compare to Ktor Client? Seems they land on similar use cases? Why might I prefer one over the other?
f
Farhan Khan
10/23/2019, 3:46 PM
ktor is supported in Kotlin native projects. OkHttp has no support yet for kotlin-native projects.
Farhan Khan
10/23/2019, 3:47 PM
Whether you want to prefer one over the other depends on your usecase/ project.
z
zak.taccardi
10/23/2019, 3:48 PM
I'm just working on an Android app
zak.taccardi
10/23/2019, 3:48 PM
Traditionally I've just always used OkHttp/retrofit
f
Farhan Khan
10/23/2019, 3:49 PM
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
Casey Brooks
10/23/2019, 3:59 PM
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