-
Notifications
You must be signed in to change notification settings - Fork 30
/
index.html
137 lines (133 loc) · 5.64 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
layout: bounce
title: Home
---
<div id="landing">
<div class="container">
<div class="row">
<div class="span6">
<h1>HTTP client/server for Clojure</h1>
<p>HTTP Kit is a <strong>minimalist</strong>, <strong>efficient</strong>,
<strong>Ring-compatible</strong> HTTP client/server for Clojure. It
uses a <strong>event-driven</strong> architecture to support
<strong>highly concurrent a/synchronous</strong> web applications.
Feature <a href="https://http-kit.github.io/server.html#channel">a unified API</a> for WebSocket and HTTP long polling/streaming</p>
{% highlight clojure %}
[http-kit "2.3.0"] ; Add to your project.clj.
{% endhighlight %}
<br />
<h3>Recent Blog Posts</h3>
<ul>
{% for post in site.posts %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>
<div class="span6">
<h3>HTTP Server <a class="more" href="server.html">documentation</a></h3>
{% highlight clojure %}
(defn async-handler [ring-request]
;; unified API for WebSocket and HTTP long polling/streaming
(with-channel ring-request channel ; get the channel
(if (websocket? channel) ; if you want to distinguish them
(on-receive channel (fn [data] ; two way communication
(send! channel data)))
(send! channel {:status 200
:headers {"Content-Type" "text/plain"}
:body "Long polling?"}))))
(run-server async-handler {:port 8080}) ; Ring server{% endhighlight %}
<h3>HTTP Client <a class="more" href="client.html">documentation</a></h3>
{% highlight clojure %}
;; start concurrent requests, get promise, half the waiting time
(let [response1 (http-kit/get "http://http-kit.org/")
response2 (http-kit/get "http://clojure.org/")]
;; Handle responses one-by-one, blocking as necessary
;; Other keys :headers :body :error :opts
(println "response1's status: " (:status @response1))
(println "response2's status: " (:status @response2))){% endhighlight %}
</div>
</div>
</div>
</div>
<div id="content" class="">
<div class="container txt-middle">
<div class="row">
<div class="span4 bouncy">
<h2>Ring Compliant</h2>
<p>
HTTP Kit is an <a href="migration.html">(almost)</a> drop-in
replacement for the standard Ring Jetty adapter. So you can use it
with all your current libraries
(e.g. <a href="server.html#routing">Compojure</a>)
and middleware.
</p>
</div>
<div class="span4 bouncy">
<h2>High Performance</h2>
<p>
Using an event-driven architecture like Nginx, HTTP-kit
is <a href="https://github.com/ptaoussanis/clojure-web-server-benchmarks">
very, very fast</a>. It comfortably handles tens of thousands of
requests/sec on even midrange hardware.
<a href="http://www.techempower.com/benchmarks/#section=data-r3">Here</a> is another test about how it stacks up with others.
</p>
</div>
<div class="span4 bouncy">
<h2>High Concurrency</h2>
<p>
It's not only fast,
but <a href="600k-concurrent-connection-http-kit.html">efficient</a>!
Each connection costs nothing but a few kB of memory. RAM usage grows O(n) with connections.
</p>
</div>
</div>
<div class="row">
<div class="span4 bouncy">
<h2>Clean, Simple, Small</h2>
<p>
Written from the ground-up to be lean, the entire client/server is
available as a single ~90kB JAR with zero dependencies and
<a href="http-kit-clean-small.html">~3k lines of (mostly Java) code</a>.
</p>
</div>
<div class="span4 bouncy">
<h2>Sync or Async</h2>
<p>
Synchronous is simple. Asynchronous is fast & flexible. With
HTTP Kit you get the best of both with a <a href="client.html">simple API</a> that lets you
mix & match to best fit your use case.
</p>
</div>
<div class="span4 bouncy">
<h2>WebSockets and Comet</h2>
<p>
With great out-the-box support for both
<a href="server.html#websocket">WebSockets</a> and efficient
handling of
<a href="server.html#async">long-held HTTP requests</a>,
realtime web applications are a breeze to write.
</p>
</div>
<div class="span4 offset4 bouncy">
<h2>Open Source</h2>
<p>
HTTP Kit is
on <a href="https://github.com/http-kit/http-kit">GitHub</a> and is
distributed under
the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">
Apache License Version 2.0</a>. Want to make it better? Contributing is just
a pull request away!
</p>
<ul class="bs-docs-social-buttons">
<li>
<iframe class="github-btn" src="http://ghbtns.com/github-btn.html?user=http-kit&repo=http-kit&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="102px" height="20px"></iframe>
</li>
<li>
<iframe class="github-btn" src="http://ghbtns.com/github-btn.html?user=http-kit&repo=http-kit&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
</li>
</ul>
</div>
<div class="span4 bounch"></div>
</div>
</div>
</div>