How does one gracefully end HTTP2 communications between a client and server in Node?
To do so one has to end the following objects using the relevant methods and events:
+---------------------+------------------+-----------------------+
| Object | Relevant Methods | Relevant Events |
+---------------------+------------------+-----------------------+
| Http2Server | close | close |
| ServerHttp2Session | close | close, goaway |
| Http2ServerResponse | end | finish, close |
| ServerHttp2Stream | end, close | finish, end and close |
| ClientHttp2Session | close | close, goaway |
| ClientHttp2Stream | end, close | finish, end and close |
+---------------------+------------------+-----------------------+
My thoughts are it could be something like:
clientHttp2Stream.end() // close write side
clientHttp2Stream.close() // required?
then
serverHttp2Stream.end() // or http2ServerResponse.end()?
serverHttp2Stream.close()
then
serverHttp2Stream.on('end',()=>http2Server.close())
and
clientHttp2Stream.on('end',()=>clientHttp2Session.close())
However, this raises the abort event for http2ServerRequest and serverHttp2Stream
If .close() is not called on the streams, then serverHttp2Session raise a goaway event which may be right?