|
1 // [node-http2-protocol][homepage] is an implementation of the [HTTP/2 (draft 10)][http2] |
|
2 // framing layer for [node.js][node]. |
|
3 // |
|
4 // The main building blocks are [node.js streams][node-stream] that are connected through pipes. |
|
5 // |
|
6 // The main components are: |
|
7 // |
|
8 // * [Endpoint](endpoint.html): represents an HTTP/2 endpoint (client or server). It's |
|
9 // responsible for the the first part of the handshake process (sending/receiving the |
|
10 // [connection header][http2-connheader]) and manages other components (framer, compressor, |
|
11 // connection, streams) that make up a client or server. |
|
12 // |
|
13 // * [Connection](connection.html): multiplexes the active HTTP/2 streams, manages connection |
|
14 // lifecycle and settings, and responsible for enforcing the connection level limits (flow |
|
15 // control, initiated stream limit) |
|
16 // |
|
17 // * [Stream](stream.html): implementation of the [HTTP/2 stream concept](http2-stream). |
|
18 // Implements the [stream state machine][http2-streamstate] defined by the standard, provides |
|
19 // management methods and events for using the stream (sending/receiving headers, data, etc.), |
|
20 // and enforces stream level constraints (flow control, sending only legal frames). |
|
21 // |
|
22 // * [Flow](flow.html): implements flow control for Connection and Stream as parent class. |
|
23 // |
|
24 // * [Compressor and Decompressor](compressor.html): compression and decompression of HEADER and |
|
25 // PUSH_PROMISE frames |
|
26 // |
|
27 // * [Serializer and Deserializer](framer.html): the lowest layer in the stack that transforms |
|
28 // between the binary and the JavaScript object representation of HTTP/2 frames |
|
29 // |
|
30 // [homepage]: https://github.com/molnarg/node-http2 |
|
31 // [http2]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-10 |
|
32 // [http2-connheader]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-3.5 |
|
33 // [http2-stream]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-5 |
|
34 // [http2-streamstate]: http://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-5.1 |
|
35 // [node]: http://nodejs.org/ |
|
36 // [node-stream]: http://nodejs.org/api/stream.html |
|
37 // [node-https]: http://nodejs.org/api/https.html |
|
38 // [node-http]: http://nodejs.org/api/http.html |
|
39 |
|
40 exports.ImplementedVersion = 'h2-10'; |
|
41 |
|
42 exports.Endpoint = require('./endpoint').Endpoint; |
|
43 |
|
44 /* Bunyan serializers exported by submodules that are worth adding when creating a logger. */ |
|
45 exports.serializers = {}; |
|
46 var modules = ['./framer', './compressor', './flow', './connection', './stream', './endpoint']; |
|
47 modules.map(require).forEach(function(module) { |
|
48 for (var name in module.serializers) { |
|
49 exports.serializers[name] = module.serializers[name]; |
|
50 } |
|
51 }); |
|
52 |
|
53 /* |
|
54 Stream API Endpoint API |
|
55 Stream data |
|
56 |
|
57 | ^ | ^ |
|
58 | | | | |
|
59 | | | | |
|
60 +-----------|------------|---------------------------------------+ |
|
61 | | | Endpoint | |
|
62 | | | | |
|
63 | +-------|------------|-----------------------------------+ | |
|
64 | | | | Connection | | |
|
65 | | v | | | |
|
66 | | +-----------------------+ +-------------------- | | |
|
67 | | | Stream | | Stream ... | | |
|
68 | | +-----------------------+ +-------------------- | | |
|
69 | | | ^ | ^ | | |
|
70 | | v | v | | | |
|
71 | | +------------+--+--------+--+------------+- ... | | |
|
72 | | | ^ | | |
|
73 | | | | | | |
|
74 | +-----------------------|--------|-----------------------+ | |
|
75 | | | | |
|
76 | v | | |
|
77 | +--------------------------+ +--------------------------+ | |
|
78 | | Compressor | | Decompressor | | |
|
79 | +--------------------------+ +--------------------------+ | |
|
80 | | ^ | |
|
81 | v | | |
|
82 | +--------------------------+ +--------------------------+ | |
|
83 | | Serializer | | Deserializer | | |
|
84 | +--------------------------+ +--------------------------+ | |
|
85 | | ^ | |
|
86 +---------------------------|--------|---------------------------+ |
|
87 | | |
|
88 v | |
|
89 |
|
90 Raw data |
|
91 |
|
92 */ |