@@ -344,6 +344,44 @@ acknowledgement for a sent SETTINGS frame. Will be `true` after calling the
344
344
` http2session.settings() ` method. Will be ` false ` once all sent SETTINGS
345
345
frames have been acknowledged.
346
346
347
+ #### http2session.ping([ payload, ] callback)
348
+ <!-- YAML
349
+ added: REPLACEME
350
+ -->
351
+
352
+ * ` payload ` {Buffer|TypedArray|DataView} Optional ping payload.
353
+ * ` callback ` {Function}
354
+ * Returns: {boolean}
355
+
356
+ Sends a ` PING ` frame to the connected HTTP/2 peer. A ` callback ` function must
357
+ be provided. The method will return ` true ` if the ` PING ` was sent, ` false `
358
+ otherwise.
359
+
360
+ The maximum number of outstanding (unacknowledged) pings is determined by the
361
+ ` maxOutstandingPings ` configuration option. The default maximum is 10.
362
+
363
+ If provided, the ` payload ` must be a ` Buffer ` , ` TypedArray ` , or ` DataView `
364
+ containing 8-bytes of data that will be transmitted with the ` PING ` and
365
+ returned with the ping acknowledgement.
366
+
367
+ The callback will be invoked with three arguments: an error argument that will
368
+ be ` null ` if the ` PING ` was successfully acknowledged, a ` duration ` argument
369
+ that reports the number of milliseconds elapsed since the ping was sent and the
370
+ acknowledgement was received, and a ` Buffer ` containing the 8-byte ` PING `
371
+ payload.
372
+
373
+ ``` js
374
+ session .ping (Buffer .from (' abcdefgh' ), (err , duration , payload ) => {
375
+ if (! err) {
376
+ console .log (` Ping acknowledged in ${ duration} milliseconds` );
377
+ console .log (` With payload '${ payload .toString ()} ` );
378
+ }
379
+ });
380
+ ```
381
+
382
+ If the ` payload ` argument is not specified, the default payload will be the
383
+ 64-bit timestamp (little endian) marking the start of the ` PING ` duration.
384
+
347
385
#### http2session.remoteSettings
348
386
<!-- YAML
349
387
added: v8.4.0
@@ -411,19 +449,6 @@ the trailing header fields to send to the peer.
411
449
will be emitted if the ` getTrailers ` callback attempts to set such header
412
450
fields.
413
451
414
- #### http2session.rstStream(stream, code)
415
- <!-- YAML
416
- added: v8.4.0
417
- -->
418
-
419
- * stream {Http2Stream}
420
- * code {number} Unsigned 32-bit integer identifying the error code. ** Default:**
421
- ` http2.constant.NGHTTP2_NO_ERROR ` (` 0x00 ` )
422
- * Returns: {undefined}
423
-
424
- Sends an ` RST_STREAM ` frame to the connected HTTP/2 peer, causing the given
425
- ` Http2Stream ` to be closed on both sides using [ error code] [ ] ` code ` .
426
-
427
452
#### http2session.setTimeout(msecs, callback)
428
453
<!-- YAML
429
454
added: v8.4.0
@@ -515,28 +540,6 @@ added: v8.4.0
515
540
516
541
An object describing the current status of this ` Http2Session ` .
517
542
518
- #### http2session.priority(stream, options)
519
- <!-- YAML
520
- added: v8.4.0
521
- -->
522
-
523
- * ` stream ` {Http2Stream}
524
- * ` options ` {Object}
525
- * ` exclusive ` {boolean} When ` true ` and ` parent ` identifies a parent Stream,
526
- the given stream is made the sole direct dependency of the parent, with
527
- all other existing dependents made a dependent of the given stream. ** Default:**
528
- ` false `
529
- * ` parent ` {number} Specifies the numeric identifier of a stream the given
530
- stream is dependent on.
531
- * ` weight ` {number} Specifies the relative dependency of a stream in relation
532
- to other streams with the same ` parent ` . The value is a number between ` 1 `
533
- and ` 256 ` (inclusive).
534
- * ` silent ` {boolean} When ` true ` , changes the priority locally without
535
- sending a ` PRIORITY ` frame to the connected peer.
536
- * Returns: {undefined}
537
-
538
- Updates the priority for the given ` Http2Stream ` instance.
539
-
540
543
#### http2session.settings(settings)
541
544
<!-- YAML
542
545
added: v8.4.0
@@ -624,8 +627,7 @@ is not yet ready for use.
624
627
All [ ` Http2Stream ` ] [ ] instances are destroyed either when:
625
628
626
629
* An ` RST_STREAM ` frame for the stream is received by the connected peer.
627
- * The ` http2stream.rstStream() ` or ` http2session.rstStream() ` methods are
628
- called.
630
+ * The ` http2stream.rstStream() ` methods is called.
629
631
* The ` http2stream.destroy() ` or ` http2session.destroy() ` methods are called.
630
632
631
633
When an ` Http2Stream ` instance is destroyed, an attempt will be made to send an
@@ -1473,6 +1475,10 @@ not be emitted.
1473
1475
<!-- YAML
1474
1476
added: v8.4.0
1475
1477
changes:
1478
+ - version: REPLACEME
1479
+ pr-url: https://github.com/nodejs/node/pull/17105
1480
+ description: Added the `maxOutstandingPings` option with a default limit of
1481
+ 10.
1476
1482
- version: v9.1.0
1477
1483
pr-url: https://github.com/nodejs/node/pull/16676
1478
1484
description: Added the `maxHeaderListPairs` option with a default limit of
@@ -1484,6 +1490,8 @@ changes:
1484
1490
for deflating header fields. ** Default:** ` 4Kib `
1485
1491
* ` maxHeaderListPairs ` {number} Sets the maximum number of header entries.
1486
1492
** Default:** ` 128 ` . The minimum value is ` 4 ` .
1493
+ * ` maxOutstandingPings ` {number} Sets the maximum number of outstanding,
1494
+ unacknowledged pings. The default is ` 10 ` .
1487
1495
* ` maxSendHeaderBlockLength ` {number} Sets the maximum allowed size for a
1488
1496
serialized, compressed block of headers. Attempts to send headers that
1489
1497
exceed this limit will result in a ` 'frameError' ` event being emitted
@@ -1535,6 +1543,10 @@ server.listen(80);
1535
1543
<!-- YAML
1536
1544
added: v8.4.0
1537
1545
changes:
1546
+ - version: REPLACEME
1547
+ pr-url: https://github.com/nodejs/node/pull/17105
1548
+ description: Added the `maxOutstandingPings` option with a default limit of
1549
+ 10.
1538
1550
- version: v9.1.0
1539
1551
pr-url: https://github.com/nodejs/node/pull/16676
1540
1552
description: Added the `maxHeaderListPairs` option with a default limit of
@@ -1549,6 +1561,8 @@ changes:
1549
1561
for deflating header fields. ** Default:** ` 4Kib `
1550
1562
* ` maxHeaderListPairs ` {number} Sets the maximum number of header entries.
1551
1563
** Default:** ` 128 ` . The minimum value is ` 4 ` .
1564
+ * ` maxOutstandingPings ` {number} Sets the maximum number of outstanding,
1565
+ unacknowledged pings. The default is ` 10 ` .
1552
1566
* ` maxSendHeaderBlockLength ` {number} Sets the maximum allowed size for a
1553
1567
serialized, compressed block of headers. Attempts to send headers that
1554
1568
exceed this limit will result in a ` 'frameError' ` event being emitted
@@ -1607,6 +1621,10 @@ server.listen(80);
1607
1621
<!-- YAML
1608
1622
added: v8.4.0
1609
1623
changes:
1624
+ - version: REPLACEME
1625
+ pr-url: https://github.com/nodejs/node/pull/17105
1626
+ description: Added the `maxOutstandingPings` option with a default limit of
1627
+ 10.
1610
1628
- version: v9.1.0
1611
1629
pr-url: https://github.com/nodejs/node/pull/16676
1612
1630
description: Added the `maxHeaderListPairs` option with a default limit of
@@ -1619,6 +1637,8 @@ changes:
1619
1637
for deflating header fields. ** Default:** ` 4Kib `
1620
1638
* ` maxHeaderListPairs ` {number} Sets the maximum number of header entries.
1621
1639
** Default:** ` 128 ` . The minimum value is ` 1 ` .
1640
+ * ` maxOutstandingPings ` {number} Sets the maximum number of outstanding,
1641
+ unacknowledged pings. The default is ` 10 ` .
1622
1642
* ` maxReservedRemoteStreams ` {number} Sets the maximum number of reserved push
1623
1643
streams the client will accept at any given time. Once the current number of
1624
1644
currently reserved push streams exceeds reaches this limit, new push streams
0 commit comments