https://kotlinlang.org logo
#getting-started
Title
# getting-started
s

speed_star

10/29/2020, 3:27 AM
Hi. Do you know about good library for http client? I want to call external api via http client. My project is Spring boot (server side, not Android) I'm using https://github.com/square/okhttp now. Because there are some merits about performance. (e.g: Connection pooling, Transparent GZIP) There is another good library?
n

ntherning

10/29/2020, 7:24 AM
Both https://ktor.io and https://www.http4k.org can be used as HTTP clients.
Both can use OkHttp under the hood to do the actual HTTP requests. But you get a nice idiomatic Kotlin interface on top of it.
s

speed_star

10/29/2020, 7:49 AM
Thank you so much. http4k looks good for Kotlin (http client is also supported) 🙂
t

tddmonkey

10/29/2020, 7:54 AM
If you’re already using Spring Boot, is there a good reason to not use the Spring WebClient?
☝️ 1
s

speed_star

10/29/2020, 7:55 AM
No, I don't have reason.
t

tddmonkey

10/29/2020, 7:59 AM
I would stick with that one seeing as you essentially get it “for free”
s

speed_star

10/29/2020, 8:04 AM
Thank you. I'm not sure if the "WebClient" have the merits that I mentioned first...
some merits about performance. (e.g: Connection pooling, Transparent GZIP)
t

tddmonkey

10/29/2020, 9:54 AM
google is your friend there
s

speed_star

10/29/2020, 9:59 AM
Yeah, I should investigate.
5 Views