@@ -413,78 +413,23 @@ session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => {
413
413
If the ` payload ` argument is not specified, the default payload will be the
414
414
64-bit timestamp (little endian) marking the start of the ` PING ` duration.
415
415
416
- #### http2session.remoteSettings
416
+ #### http2session.ref()
417
417
<!-- YAML
418
- added: v8.4.0
418
+ added: REPLACEME
419
419
-->
420
420
421
- * Value: {[ Settings Object] [ ] }
421
+ Calls [ ` ref() ` ] [ `net.Socket.prototype.ref` ] on this ` Http2Session `
422
+ instance's underlying [ ` net.Socket ` ] .
422
423
423
- A prototype-less object describing the current remote settings of this
424
- ` Http2Session ` . The remote settings are set by the * connected* HTTP/2 peer.
425
-
426
- #### http2session.request(headers[ , options] )
424
+ #### http2session.remoteSettings
427
425
<!-- YAML
428
426
added: v8.4.0
429
427
-->
430
428
431
- * ` headers ` {[ Headers Object] [ ] }
432
- * ` options ` {Object}
433
- * ` endStream ` {boolean} ` true ` if the ` Http2Stream ` * writable* side should
434
- be closed initially, such as when sending a ` GET ` request that should not
435
- expect a payload body.
436
- * ` exclusive ` {boolean} When ` true ` and ` parent ` identifies a parent Stream,
437
- the created stream is made the sole direct dependency of the parent, with
438
- all other existing dependents made a dependent of the newly created stream.
439
- ** Default:** ` false `
440
- * ` parent ` {number} Specifies the numeric identifier of a stream the newly
441
- created stream is dependent on.
442
- * ` weight ` {number} Specifies the relative dependency of a stream in relation
443
- to other streams with the same ` parent ` . The value is a number between ` 1 `
444
- and ` 256 ` (inclusive).
445
- * ` getTrailers ` {Function} Callback function invoked to collect trailer
446
- headers.
447
-
448
- * Returns: {ClientHttp2Stream}
449
-
450
- For HTTP/2 Client ` Http2Session ` instances only, the ` http2session.request() `
451
- creates and returns an ` Http2Stream ` instance that can be used to send an
452
- HTTP/2 request to the connected server.
453
-
454
- This method is only available if ` http2session.type ` is equal to
455
- ` http2.constants.NGHTTP2_SESSION_CLIENT ` .
456
-
457
- ``` js
458
- const http2 = require (' http2' );
459
- const clientSession = http2 .connect (' https://localhost:1234' );
460
- const {
461
- HTTP2_HEADER_PATH ,
462
- HTTP2_HEADER_STATUS
463
- } = http2 .constants ;
464
-
465
- const req = clientSession .request ({ [HTTP2_HEADER_PATH ]: ' /' });
466
- req .on (' response' , (headers ) => {
467
- console .log (headers[HTTP2_HEADER_STATUS ]);
468
- req .on (' data' , (chunk ) => { /** .. **/ });
469
- req .on (' end' , () => { /** .. **/ });
470
- });
471
- ```
472
-
473
- When set, the ` options.getTrailers() ` function is called immediately after
474
- queuing the last chunk of payload data to be sent. The callback is passed a
475
- single object (with a ` null ` prototype) that the listener may used to specify
476
- the trailing header fields to send to the peer.
477
-
478
- * Note* : The HTTP/1 specification forbids trailers from containing HTTP/2
479
- "pseudo-header" fields (e.g. ` ':method' ` , ` ':path' ` , etc). An ` 'error' ` event
480
- will be emitted if the ` getTrailers ` callback attempts to set such header
481
- fields.
482
-
483
- The the ` :method ` and ` :path ` pseudoheaders are not specified within ` headers ` ,
484
- they respectively default to:
429
+ * Value: {[ Settings Object] [ ] }
485
430
486
- * ` :method ` = ` 'GET' `
487
- * ` :path ` = ` / `
431
+ A prototype-less object describing the current remote settings of this
432
+ ` Http2Session ` . The remote settings are set by the * connected * HTTP/2 peer.
488
433
489
434
#### http2session.setTimeout(msecs, callback)
490
435
<!-- YAML
@@ -605,6 +550,82 @@ The `http2session.type` will be equal to
605
550
server, and ` http2.constants.NGHTTP2_SESSION_CLIENT ` if the instance is a
606
551
client.
607
552
553
+ #### http2session.unref()
554
+ <!-- YAML
555
+ added: REPLACEME
556
+ -->
557
+
558
+ Calls [ ` unref() ` ] [ `net.Socket.prototype.unref` ] on this ` Http2Session `
559
+ instance's underlying [ ` net.Socket ` ] .
560
+
561
+ ### Class: ClientHttp2Session
562
+ <!-- YAML
563
+ added: v8.4.0
564
+ -->
565
+
566
+ #### clienthttp2session.request(headers[ , options] )
567
+ <!-- YAML
568
+ added: v8.4.0
569
+ -->
570
+
571
+ * ` headers ` {[ Headers Object] [ ] }
572
+ * ` options ` {Object}
573
+ * ` endStream ` {boolean} ` true ` if the ` Http2Stream ` * writable* side should
574
+ be closed initially, such as when sending a ` GET ` request that should not
575
+ expect a payload body.
576
+ * ` exclusive ` {boolean} When ` true ` and ` parent ` identifies a parent Stream,
577
+ the created stream is made the sole direct dependency of the parent, with
578
+ all other existing dependents made a dependent of the newly created stream.
579
+ ** Default:** ` false `
580
+ * ` parent ` {number} Specifies the numeric identifier of a stream the newly
581
+ created stream is dependent on.
582
+ * ` weight ` {number} Specifies the relative dependency of a stream in relation
583
+ to other streams with the same ` parent ` . The value is a number between ` 1 `
584
+ and ` 256 ` (inclusive).
585
+ * ` getTrailers ` {Function} Callback function invoked to collect trailer
586
+ headers.
587
+
588
+ * Returns: {ClientHttp2Stream}
589
+
590
+ For HTTP/2 Client ` Http2Session ` instances only, the ` http2session.request() `
591
+ creates and returns an ` Http2Stream ` instance that can be used to send an
592
+ HTTP/2 request to the connected server.
593
+
594
+ This method is only available if ` http2session.type ` is equal to
595
+ ` http2.constants.NGHTTP2_SESSION_CLIENT ` .
596
+
597
+ ``` js
598
+ const http2 = require (' http2' );
599
+ const clientSession = http2 .connect (' https://localhost:1234' );
600
+ const {
601
+ HTTP2_HEADER_PATH ,
602
+ HTTP2_HEADER_STATUS
603
+ } = http2 .constants ;
604
+
605
+ const req = clientSession .request ({ [HTTP2_HEADER_PATH ]: ' /' });
606
+ req .on (' response' , (headers ) => {
607
+ console .log (headers[HTTP2_HEADER_STATUS ]);
608
+ req .on (' data' , (chunk ) => { /** .. **/ });
609
+ req .on (' end' , () => { /** .. **/ });
610
+ });
611
+ ```
612
+
613
+ When set, the ` options.getTrailers() ` function is called immediately after
614
+ queuing the last chunk of payload data to be sent. The callback is passed a
615
+ single object (with a ` null ` prototype) that the listener may used to specify
616
+ the trailing header fields to send to the peer.
617
+
618
+ * Note* : The HTTP/1 specification forbids trailers from containing HTTP/2
619
+ "pseudo-header" fields (e.g. ` ':method' ` , ` ':path' ` , etc). An ` 'error' ` event
620
+ will be emitted if the ` getTrailers ` callback attempts to set such header
621
+ fields.
622
+
623
+ The ` :method ` and ` :path ` pseudoheaders are not specified within ` headers ` ,
624
+ they respectively default to:
625
+
626
+ * ` :method ` = ` 'GET' `
627
+ * ` :path ` = ` / `
628
+
608
629
### Class: Http2Stream
609
630
<!-- YAML
610
631
added: v8.4.0
@@ -1669,9 +1690,9 @@ changes:
1669
1690
[ ` Duplex ` ] [ ] stream that is to be used as the connection for this session.
1670
1691
* ...: Any [ ` net.connect() ` ] [ ] or [ ` tls.connect() ` ] [ ] options can be provided.
1671
1692
* ` listener ` {Function}
1672
- * Returns {Http2Session }
1693
+ * Returns {ClientHttp2Session }
1673
1694
1674
- Returns a HTTP/2 client ` Http2Session ` instance.
1695
+ Returns a ` ClientHttp2Session ` instance.
1675
1696
1676
1697
``` js
1677
1698
const http2 = require (' http2' );
@@ -2806,6 +2827,8 @@ if the stream is closed.
2806
2827
[ `http2.createServer()` ] : #http2_http2_createserver_options_onrequesthandler
2807
2828
[ `http2stream.pushStream()` ] : #http2_http2stream_pushstream_headers_options_callback
2808
2829
[ `net.Socket` ] : net.html#net_class_net_socket
2830
+ [ `net.Socket.prototype.ref` ] : net.html#net_socket_ref
2831
+ [ `net.Socket.prototype.unref` ] : net.html#net_socket_unref
2809
2832
[ `net.connect()` ] : net.html#net_net_connect
2810
2833
[ `request.socket.getPeerCertificate()` ] : tls.html#tls_tlssocket_getpeercertificate_detailed
2811
2834
[ `response.end()` ] : #http2_response_end_data_encoding_callback
0 commit comments