• headers {HTTP/2 Headers Object}
    • options {Object}
      • exclusive {boolean} When true and parent identifies a parent Stream, the created stream is made the sole direct dependency of the parent, with all other existing dependents made a dependent of the newly created stream. Default: false.
      • parent {number} Specifies the numeric identifier of a stream the newly created stream is dependent on.
    • callback {Function} Callback that is called once the push stream has been initiated.
      • err {Error}
      • pushStream {ServerHttp2Stream} The returned pushStream object.
      • headers {HTTP/2 Headers Object} Headers object the pushStream was initiated with.

    Initiates a push stream. The callback is invoked with the new Http2Stream instance created for the push stream passed as the second argument, or an Error passed as the first argument.

    1. const http2 = require('http2');
    2. const server = http2.createServer();
    3. server.on('stream', (stream) => {
    4. stream.respond({ ':status': 200 });
    5. stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => {
    6. if (err) throw err;
    7. pushStream.respond({ ':status': 200 });
    8. pushStream.end('some pushed data');
    9. });
    10. stream.end('some data');
    11. });

    Setting the weight of a push stream is not allowed in the HEADERS frame. Pass a weight value to http2stream.priority with the silent option set to true to enable server-side bandwidth balancing between concurrent streams.

    Calling http2stream.pushStream() from within a pushed stream is not permitted and will throw an error.