|
5 | 5 |
|
6 | 6 | Alternative Netty implementation of [RFC6455](https://tools.ietf.org/html/rfc6455) - the WebSocket protocol.
|
7 | 7 |
|
8 |
| -Its advantage is significant per-core throughput improvement (1.8 - 2x) for small frames in comparison to netty's out-of-the-box |
9 |
| -websocket codecs, and minimal heap allocations on frame path. Library is compatible with |
| 8 | +Its advantages are significant per-core throughput improvement (1.8 - 2x) for small frames compared to netty's out-of-the-box |
| 9 | +websocket codecs, minimal heap allocations on frame path, and compatibility with |
10 | 10 | [netty-websocket-http2](https://github.com/jauntsdn/netty-websocket-http2).
|
11 | 11 |
|
12 | 12 | ### use case & scope
|
13 | 13 |
|
14 |
| -* Intended for efficiently encoded, dense binary data: no extensions (compression) support / outbound text frames / inbound |
15 |
| -utf8 validation. |
| 14 | +* Intended for dense binary data & small text messages: no extensions (compression) support. |
| 15 | + |
| 16 | +* No per-frame heap allocations in websocket frameFactory / decoder. |
16 | 17 |
|
17 | 18 | * Library assumes small frames - many have payload <= 125 bytes, most are < 1500, maximum supported is 65k (65535 bytes).
|
18 | 19 |
|
19 |
| -* Just codec - fragments, pings, close frames are decoded & validated only. It is responsibility of user code |
| 20 | +* Just codec - fragments, pings, close frames are decoded & protocol validated only. It is responsibility of user code |
20 | 21 | to handle frames according to protocol (reassemble frame fragments, perform graceful close,
|
21 |
| -respond to pings). |
22 |
| - |
23 |
| -* Dedicated decoder for case of exchanging tiny messages over TLS connection: |
24 |
| -only non-masked frames with <= 125 bytes of payload for minimal per-webSocket state (memory) overhead. |
25 |
| - |
26 |
| -* No per-frame heap allocations in websocket frameFactory / decoder. |
| 22 | +respond to pings) and do utf8 validation of inbound text frames ([utility](https://github.com/jauntsdn/netty-websocket-http1/blob/fb7bbb12d4fc0e62a72845dee89fe8f1d86f9a0a/netty-websocket-http1/src/main/java/com/jauntsdn/netty/handler/codec/http/websocketx/WebSocketFrameListener.java#L81) is provided). |
27 | 23 |
|
28 | 24 | * Single-threaded (transport IO event-loop) callbacks / frame factory API -
|
29 |
| -in practice user code has its own message types to carry data, external means (e.g. mpsc / spsc queues) may be used to |
| 25 | +in practice user code has its own message types to carry data, and external means (e.g. mpsc / spsc queues) may be used to |
30 | 26 | properly publish messages on eventloop thread.
|
31 | 27 |
|
| 28 | +* On encoder side 3 use cases are supported: frame factory [[1]](https://github.com/jauntsdn/netty-websocket-http1/blob/fb7bbb12d4fc0e62a72845dee89fe8f1d86f9a0a/netty-websocket-http1-test/src/test/java/com/jauntsdn/netty/handler/codec/http/websocketx/WebSocketCodecTest.java#L1475) (create bytebuffer and encode frame prefix), |
| 29 | +frame encoder [[2]](https://github.com/jauntsdn/netty-websocket-http1/blob/fb7bbb12d4fc0e62a72845dee89fe8f1d86f9a0a/netty-websocket-http1-test/src/test/java/com/jauntsdn/netty/handler/codec/http/websocketx/WebSocketCodecTest.java#L1019) (encode frame prefix into provided bytebuffer), |
| 30 | +frame bulk-encoder [[3]](https://github.com/jauntsdn/netty-websocket-http1/blob/fb7bbb12d4fc0e62a72845dee89fe8f1d86f9a0a/netty-websocket-http1-test/src/test/java/com/jauntsdn/netty/handler/codec/http/websocketx/WebSocketCodecTest.java#L707) (much more performant - encode multiple frames into provided bytebuffer). |
| 31 | + |
| 32 | +* Dedicated decoder for case of exchanging tiny messages over TLS connection: |
| 33 | +only non-masked frames with <= 125 bytes of payload for minimal per-webSocket state (memory) overhead. |
| 34 | + |
32 | 35 | ### performance
|
33 | 36 |
|
34 | 37 | Per-core throughput [this codec perf-test](https://github.com/jauntsdn/netty-websocket-http1/tree/develop/netty-websocket-http1-perftest/src/main/java/com/jauntsdn/netty/handler/codec/http/websocketx/perftest),
|
@@ -77,6 +80,11 @@ to create outbound frames. It is library user responsibility to mask outbound fr
|
77 | 80 | public interface WebSocketFrameFactory {
|
78 | 81 |
|
79 | 82 | ByteBuf createBinaryFrame(ByteBufAllocator allocator, int binaryDataSize);
|
| 83 | + |
| 84 | + // ByteBuf createTextFrame(ByteBufAllocator allocator, int binaryDataSize); |
| 85 | + |
| 86 | + // ByteBuf create*Fragment*(ByteBufAllocator allocator, int textDataSize); |
| 87 | + |
80 | 88 | // create*Frame are omitted for control frames, created in similar fashion
|
81 | 89 |
|
82 | 90 | ByteBuf mask(ByteBuf frame);
|
@@ -159,7 +167,7 @@ repositories {
|
159 | 167 | }
|
160 | 168 |
|
161 | 169 | dependencies {
|
162 |
| - implementation "com.jauntsdn.netty:netty-websocket-http1:1.1.3" |
| 170 | + implementation "com.jauntsdn.netty:netty-websocket-http1:1.1.4" |
163 | 171 | }
|
164 | 172 | ```
|
165 | 173 |
|
|
0 commit comments