I am trying to write a http file downloader in Clojure, and in one of my other questions, someone commented that using a dedicated http client library is better than coding with Clojure's and Java's own api. I did some research and found some, but I couldn't figure out features, pros and cons of each. So if some one can explain how they are different and which one is a good match to my project, that would be much appreciated. :-D
Libraries originally in Java, and corresponding Clojure wrappers:
Apache HttpClient and its Clojure wrapper clj-http
Apache HttpAsyncClient and couldn't find any Clojure wrapper.
Netty and Clojure "wrapper" is Aleph, I guess?
Async Http Client and its Clojure wrapper http.async.client
Last but not least, a Clojure library:
http-kit
I can only compare http-kit and clj-http.
clj-http:
http-kit:
If you care about dependencies, http-kit may be a better choice because it is a standalone library with no other dependencies than clojure.core. Because of that it produces smaller uberjars. For a sample HTTP GET project:
clj-http:
1.2M clj-http-test-0.1.0-SNAPSHOT.jar
6.7M clj-http-test-0.1.0-SNAPSHOT-standalone.jar
http-kit:
65K http-kit-test-0.1.0-SNAPSHOT.jar
3.8M http-kit-test-0.1.0-SNAPSHOT-standalone.jar
On the other hand you may choose clj-http if you prefer to trust the battle tested Apache HttpComponents and potentially better support from bigger Java community.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With