What alternatives can you recommend to Ktor client...
# multiplatform
s
What alternatives can you recommend to Ktor client for shared network code (iOS, Android, JVM)? (I tried Ktor, but is really has a lot of bugs and is slow to adopt changes like the M1 transition. I don't like it as all.)
f
You can always use separate clients for each platform if you create some clever abstraction. I also struggled with Ktor client and it's JVM and JS iplementation of sockets. I ended up using OkHttp for JVM and WS for JS. Btw I think OkHttp is eventually going to be multiplatform when Okio migrated recently. I know it's not really an answer to your question but I don't know of any other KMP HTTP client from top of my head
w
🤔 We are using ktor in KMM, just for Android and iOS, and have not noticed any issues. But also we don’t have complex network requirements. We use cert pinning, oauth, some headers, and calls are usually GET and POST, nothing fancy.
s
@wbertan Do you use Ktor to connect Dropbox? I just filled https://youtrack.jetbrains.com/issue/KTOR-3332
🚫 1
@Filip Wiesner OkHttp going multiplatform would be really nice. I love Retrofit. 🙂
s
If I understand correctly, then ktor already brings that clever abstraction. You'll have to provide the
io.ktor.client.HttpClient
in a platform-dependent way - then for android, you can provide it as
Copy code
HttpClient(OKHttp) {
  // config it more
}
e
Hey, thanks for the honest feedback about Ktor! It would be really great if you also report us problems and pain points. Btw we’re going to release lots of improvements in the client API with Ktor 2.0.0(as long as Apple Silicon support). We strive to improve overall experience with Ktor and are open to all feedback you have.
👍 2
s
@e5l My latest problem had to do with configuration. I accidently put
install(JSonFeature)
inside
install(Auth)
which has no effect, but also no warning or error. I don't really get the configuration DSL, but a good system would not allow to configure nonsense.
e