Skip to content

Commit 131811e

Browse files
committed
Update more docs to refer to 0.5.0
1 parent ecba86c commit 131811e

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66

77
Aleph exposes data from the network as a [Manifold](https://github.com/clj-commons/manifold) stream, which can easily be transformed into a `java.io.InputStream`, [core.async](https://github.com/clojure/core.async) channel, Clojure sequence, or [many other byte representations](https://github.com/clj-commons/byte-streams). It exposes simple default wrappers for HTTP, TCP, and UDP, but allows access to full performance and flexibility of the underlying [Netty](https://github.com/netty/netty) library.
88

9-
```clj
10-
[aleph "0.4.7"]
9+
Leiningen:
10+
```clojure
11+
[aleph "0.5.0-rc2"]
12+
```
13+
deps.edn:
14+
```clojure
15+
aleph/aleph {:mvn/version "0.5.0-rc2"}
1116
```
1217

1318
### HTTP
1419

15-
Aleph follows the [Ring](https://github.com/ring-clojure) spec fully, and can be a drop-in replacement for any existing Ring-compliant server. However, it also allows for the handler function to return a [Manifold deferred](https://github.com/clj-commons/manifold) to represent an eventual response. This feature may not play nicely with synchronous Ring middleware which modifies the response, but this can be easily fixed by reimplementing the middleware using Manifold's [let-flow](https://github.com/clj-commons/manifold/blob/master/doc/deferred.md#let-flow) operator. `aleph.http/wrap-ring-async-handler` helper can be used to covert async 3-arity Ring handler to Aleph-compliant one.
20+
Aleph follows the [Ring](https://github.com/ring-clojure) spec fully, and can be a drop-in replacement for any existing Ring-compliant server. However, it also allows for the handler function to return a [Manifold deferred](https://github.com/clj-commons/manifold) to represent an eventual response. This feature may not play nicely with synchronous Ring middleware which modifies the response, but this can be easily fixed by reimplementing the middleware using Manifold's [let-flow](https://github.com/clj-commons/manifold/blob/master/doc/deferred.md#let-flow) operator. The `aleph.http/wrap-ring-async-handler` helper can be used to covert async 3-arity Ring handler to Aleph-compliant one.
1621

17-
```clj
22+
```clojure
1823
(require '[aleph.http :as http])
1924

2025
(defn handler [req]
@@ -29,20 +34,20 @@ The body of the response may also be a Manifold stream, where each message from
2934

3035
For HTTP client requests, Aleph models itself after [clj-http](https://github.com/dakrone/clj-http), except that every request immediately returns a Manifold deferred representing the response.
3136

32-
```clj
37+
```clojure
3338
(require
3439
'[manifold.deferred :as d]
3540
'[byte-streams :as bs])
3641

3742
(-> @(http/get "https://google.com/")
38-
:body
39-
bs/to-string
40-
prn)
43+
:body
44+
bs/to-string
45+
prn)
4146

4247
(d/chain (http/get "https://google.com")
43-
:body
44-
bs/to-string
45-
prn)
48+
:body
49+
bs/to-string
50+
prn)
4651
```
4752

4853
Aleph attempts to mimic the clj-http API and capabilities fully. It supports multipart/form-data requests, cookie stores, proxy servers and requests inspection with a few notable differences:
@@ -71,7 +76,7 @@ To learn more, [read the example code](http://aleph.io/examples/literate.html#al
7176

7277
On any HTTP request which has the proper `Upgrade` headers, you may call `(aleph.http/websocket-connection req)`, which returns a deferred which yields a **duplex stream**, which uses a single stream to represent bidirectional communication. Messages from the client can be received via `take!`, and sent to the client via `put!`. An echo WebSocket handler, then, would just consist of:
7378

74-
```clj
79+
```clojure
7580
(require '[manifold.stream :as s])
7681

7782
(defn echo-handler [req]
@@ -91,7 +96,7 @@ A TCP server is similar to an HTTP server, except that for each connection the h
9196

9297
An echo TCP server is very similar to the above WebSocket example:
9398

94-
```clj
99+
```clojure
95100
(require '[aleph.tcp :as tcp])
96101

97102
(defn echo-handler [s info]
@@ -108,7 +113,7 @@ To learn more, [read the example code](http://aleph.io/examples/literate.html#al
108113

109114
A UDP socket can be generated using `(aleph.udp/socket {:port 10001, :broadcast? false})`. If the `:port` is specified, it will yield a duplex socket which can be used to send and receive messages, which are structured as maps with the following data:
110115

111-
```clj
116+
```clojure
112117
{:host "example.com"
113118
:port 10001
114119
:message ...}

examples/project.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(defproject aleph.examples "0.4.7"
2-
:dependencies [[aleph "0.4.7"]
1+
(defproject aleph.examples "0.5.0"
2+
:dependencies [[aleph "0.5.0-rc2"]
33
[gloss "0.2.6"]
44
[compojure "1.6.1"]
5-
[org.clojure/clojure "1.9.0"]
5+
[org.clojure/clojure "1.11.1"]
66
[org.clojure/core.async "0.4.474"]]
77
:plugins [[lein-marginalia "0.9.1"]])

src/aleph/http/server.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
(map #(HttpHeaders/newEntity %) ["Server" "Connection" "Date"])
115115

116116
[server-value keep-alive-value close-value]
117-
(map #(HttpHeaders/newEntity %) ["Aleph/0.4.7" "Keep-Alive" "Close"])]
117+
(map #(HttpHeaders/newEntity %) ["Aleph/0.5.0" "Keep-Alive" "Close"])]
118118
(defn send-response
119119
[^ChannelHandlerContext ctx keep-alive? ssl? rsp]
120120
(let [[^HttpResponse rsp body]

0 commit comments

Comments
 (0)