Skip to content
Async Http Client - Clojure
Branch: master
Clone or download
Latest commit 79caf1b Feb 11, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
gh-pages @ 89ac7a0 Update gh-pages Aug 26, 2016
src/clj/http/async Use more conventional commenting style Mar 26, 2018
test-resources Added support for x509 client certificates. All unit tests are passing. Feb 17, 2012
test/http/async Use more conventional commenting style Mar 26, 2018
.gitmodules Update generated documentation reference Jun 12, 2015
LICENSE-2.0.txt Attached Apache License. Jun 27, 2010 Update documentation Feb 11, 2019
org-publish-project-alist.el Tweak internal documentation Aug 25, 2016

http.async.client - Asynchronous HTTP Client - Clojure

http.async.client is the Asynchronous HTTP Client for Clojure. It is promise-based and uses the Asynchronous Http Client for Java for the heavy lifting.


This library uses semantic versioning. An overview of changes by version is available in the changelog.


All released artifacts are deployed to Clojars.

Build status

TravisCI is used to track the build status of intermediate commits on the following branches:



Declare dependency (using leiningen, in this example):

(defproject your-project "1.0.0-SNAPSHOT"
  :description "Your project description"
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [http.async.client "1.3.1"]])

Asynchronous GET request

(ns async-get
  (:require [http.async.client :as http]))

(with-open [client (http/create-client)]
  (let [response (http/GET client "")]
    (-> response

WebSocket client

(ns ws-client
  (:require [http.async.client :as http]))

(def url "ws://remote-websocket-url:1337")

(defn on-open [ws]
  (println "Connected to WebSocket."))

(defn on-close [ws code reason]
  (println "Connection to WebSocket closed.\n"
           (format "[%s] %s" code reason)))

(defn on-error [ws e]
  (println "ERROR:" e))

(defn handle-message [ws msg]
  (prn "got message:" msg))

(defn -main []
  (println "Connecting...")
  (with-open [client (http/create-client)]
    (let [ws (http/websocket client
                             :open  on-open
                             :close on-close
                             :error on-error
                             :text handle-message)]
      ; this loop-recur is here as a placeholder to keep the process
      ; from ending, so that the message-handling function will continue to
      ; print messages to STDOUT until Ctrl-C is pressed
      (loop [] (recur)))))

More info

It runs with Clojure 1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0 and 1.10.0. Development is against Clojure 1.9.0.

For complete documentation refer to the project documentation index.

http.async.client is distributed under Apache License, Version 2.0.

If you would like to report an problem or submit a request, create an issue.

Finally, much thanks is owed to those contributors who have made this project so successful.

You can’t perform that action at this time.