@@ -3283,6 +3283,25 @@ deprecated: v13.0.0 |
3283 | 3283 |
|
3284 | 3284 | See [`response.socket`][]. |
3285 | 3285 |
|
| 3286 | +#### `response.createPushResponse(headers, callback)` |
| 3287 | +<!-- YAML |
| 3288 | +added: v8.4.0 |
| 3289 | +--> |
| 3290 | + |
| 3291 | +* `headers` {HTTP/2 Headers Object} An object describing the headers |
| 3292 | +* `callback` {Function} Called once `http2stream.pushStream()` is finished, |
| 3293 | + or either when the attempt to create the pushed `Http2Stream` has failed or |
| 3294 | + has been rejected, or the state of `Http2ServerRequest` is closed prior to |
| 3295 | + calling the `http2stream.pushStream()` method |
| 3296 | + * `err` {Error} |
| 3297 | + * `res` {http2.Http2ServerResponse} The newly-created `Http2ServerResponse` |
| 3298 | + object |
| 3299 | + |
| 3300 | +Call [`http2stream.pushStream()`][] with the given headers, and wrap the |
| 3301 | +given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback |
| 3302 | +parameter if successful. When `Http2ServerRequest` is closed, the callback is |
| 3303 | +called with an error `ERR_HTTP2_INVALID_STREAM`. |
| 3304 | + |
3286 | 3305 | #### `response.end([data[, encoding]][, callback])` |
3287 | 3306 | <!-- YAML |
3288 | 3307 | added: v8.4.0 |
@@ -3680,25 +3699,6 @@ const server = http2.createServer((req, res) => { |
3680 | 3699 | Attempting to set a header field name or value that contains invalid characters |
3681 | 3700 | will result in a [`TypeError`][] being thrown. |
3682 | 3701 |
|
3683 | | -#### `response.createPushResponse(headers, callback)` |
3684 | | -<!-- YAML |
3685 | | -added: v8.4.0 |
3686 | | ---> |
3687 | | - |
3688 | | -* `headers` {HTTP/2 Headers Object} An object describing the headers |
3689 | | -* `callback` {Function} Called once `http2stream.pushStream()` is finished, |
3690 | | - or either when the attempt to create the pushed `Http2Stream` has failed or |
3691 | | - has been rejected, or the state of `Http2ServerRequest` is closed prior to |
3692 | | - calling the `http2stream.pushStream()` method |
3693 | | - * `err` {Error} |
3694 | | - * `res` {http2.Http2ServerResponse} The newly-created `Http2ServerResponse` |
3695 | | - object |
3696 | | - |
3697 | | -Call [`http2stream.pushStream()`][] with the given headers, and wrap the |
3698 | | -given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback |
3699 | | -parameter if successful. When `Http2ServerRequest` is closed, the callback is |
3700 | | -called with an error `ERR_HTTP2_INVALID_STREAM`. |
3701 | | - |
3702 | 3702 | ## Collecting HTTP/2 performance metrics |
3703 | 3703 |
|
3704 | 3704 | The [Performance Observer][] API can be used to collect basic performance |
|