Pros and cons of Clojure http client libraries

I am trying to write an http downloader in Clojure and in one of my other questions , someone commented that it is better to use a special http client library than encoding with Clojure and Java api. I did some research and found some, but I could not understand what the pros and cons of each. Therefore, if someone can explain how they differ and which of them correspond to my project, this would be highly appreciated.: - D

Libraries natively in Java and related Clojure wrappers:

Apache HttpClient and its shell Clojure clj-http

Apache HttpAsyncClient and could not find the Clojure shell.

Netty and Clojure "wrapper" Aleph , I think?

Async Http Client and its Clojure shell http.async.client

Last but not least, the Clojure library:

http kit

+8
java clojure
source share
2 answers

I can only compare http-kit and clj-http.

CLJ client:

  • simple API
  • HTTP client only
  • shell for Apache HttpComponents

HTTP Kit:

  • for async
  • HTTP client and server more powerful
  • client API modeled after clj-http but adds more abstractions, so the cognitive load is higher

If you care about dependencies, an http-kit might be a better choice because it is a standalone library without any other dependencies than clojure.core. Because of this, it produces smaller uberbariums. For an example 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 

Alternatively, you can choose clj-http if you prefer to trust Apache's testing of HttpComponents and it is potentially better to support the larger Java community.

+9
source

I am not going to give a complete comparison between the libraries that you sent, since I did not use all of them. But before, I used an http-kit , and that is really good.

The http-kit is easy to use, modeled after the clj-http library, by the way, and it is really effective. Although this comparison does not address your question directly, it can still shed light: TechEmpower Frameworks Round 2

+7
source

All Articles