All [Http2Stream
][] instances are destroyed either when:
- An
RST_STREAM
frame for the stream is received by the connected peer, and (for client streams only) pending data has been read. - The
http2stream.close()
method is called, and (for client streams only) pending data has been read. - The
http2stream.destroy()
orhttp2session.destroy()
methods are called.
When an Http2Stream
instance is destroyed, an attempt will be made to send an
RST_STREAM
frame to the connected peer.
When the Http2Stream
instance is destroyed, the 'close'
event will
be emitted. Because Http2Stream
is an instance of stream.Duplex
, the
'end'
event will also be emitted if the stream data is currently flowing.
The 'error'
event may also be emitted if http2stream.destroy()
was called
with an Error
passed as the first argument.
After the Http2Stream
has been destroyed, the http2stream.destroyed
property will be true
and the http2stream.rstCode
property will specify the
RST_STREAM
error code. The Http2Stream
instance is no longer usable once
destroyed.