• Jump To … +
    http.js index.js Protocol
  • index.js

  • ¶

    node-http2 is an HTTP/2 implementation for node.js.

    The core of the protocol is implemented in the protocol sub-directory. This directory provides two important features on top of the protocol:

    • Implementation of different negotiation schemes that can be used to start a HTTP2 connection. These include TLS ALPN, Upgrade and Plain TCP.

    • Providing an API very similar to the standard node.js HTTPS module API (which is in turn very similar to the HTTP module API).

    module.exports   = require('./http');
    
    /*
                      HTTP API
    
                   |            ^
                   |            |
     +-------------|------------|------------------------------------------------------+
     |             |            |        Server/Agent                                  |
     |             v            |                                                      |
     |        +----------+ +----------+                                                |
     |        | Outgoing | | Incoming |                                                |
     |        | req/res. | | req/res. |                                                |
     |        +----------+ +----------+                                                |
     |             |            ^                                                      |
     |             |            |                                                      |
     |   +---------|------------|-------------------------------------+   +-----       |
     |   |         |            |   Endpoint                          |   |            |
     |   |         |            |                                     |   |            |
     |   |         v            |                                     |   |            |
     |   |    +-----------------------+  +--------------------        |   |            |
     |   |    |        Stream         |  |         Stream      ...    |   |            |
     |   |    +-----------------------+  +--------------------        |   |            |
     |   |                                                            |   |            |
     |   +------------------------------------------------------------+   +-----       |
     |                             |        |                                          |
     |                             |        |                                          |
     |                             v        |                                          |
     |   +------------------------------------------------------------+   +-----       |
     |   |                         TCP stream                         |   |      ...   |
     |   +------------------------------------------------------------+   +-----       |
     |                                                                                 |
     +---------------------------------------------------------------------------------+
    
    */