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