The following methods are non-functional stubs:
- aborted
- bufferSize
- endAfterHeaders
- id
- pending
- priority
- rstCode
- sentHeaders
- sentInfoHeaders
- sentTrailers
- state
Properties Jump to heading
Jump to headingaborted: boolean
Set to true
if the Http2Stream
instance was aborted abnormally. When set,
the 'aborted'
event will have been emitted.
Jump to headingbufferSize: number
This property shows the number of characters currently buffered to be written.
See net.Socket.bufferSize
for details.
Jump to headingclosed: boolean
Set to true
if the Http2Stream
instance has been closed.
Jump to headingdestroyed: boolean
Set to true
if the Http2Stream
instance has been destroyed and is no longer
usable.
Jump to headingendAfterHeaders: boolean
Set to true
if the END_STREAM
flag was set in the request or response
HEADERS frame received, indicating that no additional data should be received
and the readable side of the Http2Stream
will be closed.
Jump to headingid: number | undefined
The numeric stream identifier of this Http2Stream
instance. Set to undefined
if the stream identifier has not yet been assigned.
Jump to headingpending: boolean
Set to true
if the Http2Stream
instance has not yet been assigned a
numeric stream identifier.
Jump to headingrstCode: number
Set to the RST_STREAM
error code
reported when the Http2Stream
is
destroyed after either receiving an RST_STREAM
frame from the connected peer,
calling http2stream.close()
, or http2stream.destroy()
. Will be undefined
if the Http2Stream
has not been closed.
An object containing the outbound headers sent for this Http2Stream
.
Jump to headingsentInfoHeaders: OutgoingHttpHeaders[] | undefined
An array of objects containing the outbound informational (additional) headers
sent for this Http2Stream
.
Jump to headingsentTrailers: OutgoingHttpHeaders | undefined
An object containing the outbound trailers sent for this HttpStream
.
Jump to headingsession: Http2Session | undefined
A reference to the Http2Session
instance that owns this Http2Stream
. The
value will be undefined
after the Http2Stream
instance is destroyed.
Jump to headingstate: StreamState
Provides miscellaneous information about the current state of the Http2Stream
.
A current state of this Http2Stream
.
Methods Jump to heading
Jump to headingclose(code?: number,callback?: () => void,): void
Closes the Http2Stream
instance by sending an RST_STREAM
frame to the
connected HTTP/2 peer.
Jump to headingpriority(options: StreamPriorityOptions): void
Updates the priority for this Http2Stream
instance.
Jump to headingsetTimeout(msecs: number,callback?: () => void,): void
import http2 from 'node:http2';
const client = http2.connect('http://example.org:8000');
const { NGHTTP2_CANCEL } = http2.constants;
const req = client.request({ ':path': '/' });
// Cancel the stream if there's no activity after 5 seconds
req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL));
Jump to headingsendTrailers(headers: OutgoingHttpHeaders): void
Sends a trailing HEADERS
frame to the connected HTTP/2 peer. This method
will cause the Http2Stream
to be immediately closed and must only be
called after the 'wantTrailers'
event has been emitted. When sending a
request or sending a response, the options.waitForTrailers
option must be set
in order to keep the Http2Stream
open after the final DATA
frame so that
trailers can be sent.
import http2 from 'node:http2';
const server = http2.createServer();
server.on('stream', (stream) => {
stream.respond(undefined, { waitForTrailers: true });
stream.on('wantTrailers', () => {
stream.sendTrailers({ xyz: 'abc' });
});
stream.end('Hello World');
});
The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header
fields (e.g. ':method'
, ':path'
, etc).
Jump to headingaddListener(event: "aborted",listener: () => void,): this
Jump to headingaddListener(event: "close",listener: () => void,): this
Jump to headingaddListener(event: "data",listener: (chunk: Buffer | string) => void,): this
Jump to headingaddListener(event: "drain",listener: () => void,): this
Jump to headingaddListener(event: "end",listener: () => void,): this
Jump to headingaddListener(event: "error",listener: (err: Error) => void,): this
Jump to headingaddListener(event: "finish",listener: () => void,): this
Jump to headingaddListener(event: "frameError",listener: (frameType: number,errorCode: number,) => void,): this
Jump to headingaddListener(event: "pipe",listener: (src: stream.Readable) => void,): this
Jump to headingaddListener(event: "unpipe",listener: (src: stream.Readable) => void,): this
Jump to headingaddListener(event: "streamClosed",listener: (code: number) => void,): this
Jump to headingaddListener(event: "timeout",listener: () => void,): this
Jump to headingaddListener(event: "trailers",listener: (trailers: IncomingHttpHeaders,flags: number,) => void,): this
Jump to headingaddListener(event: "wantTrailers",listener: () => void,): this
Jump to headingaddListener(event: string | symbol,listener: (...args: any[]) => void,): this
Jump to headingemit(event: "aborted"): boolean
Jump to headingemit(event: "close"): boolean
Jump to headingemit(event: "data",chunk: Buffer | string,): boolean
Jump to headingemit(event: "drain"): boolean
Jump to headingemit(event: "end"): boolean
Jump to headingemit(event: "error",err: Error,): boolean
Jump to headingemit(event: "finish"): boolean
Jump to headingemit(event: "frameError",frameType: number,errorCode: number,): boolean
Jump to headingemit(event: "pipe",src: stream.Readable,): boolean
Jump to headingemit(event: "unpipe",src: stream.Readable,): boolean
Jump to headingemit(event: "streamClosed",code: number,): boolean
Jump to headingemit(event: "timeout"): boolean
Jump to headingemit(): boolean
Jump to headingemit(event: "wantTrailers"): boolean
Jump to headingemit(event: string | symbol,...args: any[],): boolean
Jump to headingon(event: "aborted",listener: () => void,): this
Jump to headingon(event: "close",listener: () => void,): this
Jump to headingon(event: "data",listener: (chunk: Buffer | string) => void,): this
Jump to headingon(event: "drain",listener: () => void,): this
Jump to headingon(event: "end",listener: () => void,): this
Jump to headingon(event: "error",listener: (err: Error) => void,): this
Jump to headingon(event: "finish",listener: () => void,): this
Jump to headingon(event: "frameError",listener: (frameType: number,errorCode: number,) => void,): this
Jump to headingon(event: "pipe",listener: (src: stream.Readable) => void,): this
Jump to headingon(event: "unpipe",listener: (src: stream.Readable) => void,): this
Jump to headingon(event: "streamClosed",listener: (code: number) => void,): this
Jump to headingon(event: "timeout",listener: () => void,): this
Jump to headingon(event: "trailers",listener: (trailers: IncomingHttpHeaders,flags: number,) => void,): this
Jump to headingon(event: "wantTrailers",listener: () => void,): this
Jump to headingon(event: string | symbol,listener: (...args: any[]) => void,): this
Jump to headingonce(event: "aborted",listener: () => void,): this
Jump to headingonce(event: "close",listener: () => void,): this
Jump to headingonce(event: "data",listener: (chunk: Buffer | string) => void,): this
Jump to headingonce(event: "drain",listener: () => void,): this
Jump to headingonce(event: "end",listener: () => void,): this
Jump to headingonce(event: "error",listener: (err: Error) => void,): this
Jump to headingonce(event: "finish",listener: () => void,): this
Jump to headingonce(event: "frameError",listener: (frameType: number,errorCode: number,) => void,): this
Jump to headingonce(event: "pipe",listener: (src: stream.Readable) => void,): this
Jump to headingonce(event: "unpipe",listener: (src: stream.Readable) => void,): this
Jump to headingonce(event: "streamClosed",listener: (code: number) => void,): this
Jump to headingonce(event: "timeout",listener: () => void,): this
Jump to headingonce(event: "trailers",listener: (trailers: IncomingHttpHeaders,flags: number,) => void,): this
Jump to headingonce(event: "wantTrailers",listener: () => void,): this
Jump to headingonce(event: string | symbol,listener: (...args: any[]) => void,): this
Jump to headingprependListener(event: "aborted",listener: () => void,): this
Jump to headingprependListener(event: "close",listener: () => void,): this
Jump to headingprependListener(event: "data",listener: (chunk: Buffer | string) => void,): this
Jump to headingprependListener(event: "drain",listener: () => void,): this
Jump to headingprependListener(event: "end",listener: () => void,): this
Jump to headingprependListener(event: "error",listener: (err: Error) => void,): this
Jump to headingprependListener(event: "finish",listener: () => void,): this
Jump to headingprependListener(event: "frameError",listener: (frameType: number,errorCode: number,) => void,): this
Jump to headingprependListener(event: "pipe",listener: (src: stream.Readable) => void,): this
Jump to headingprependListener(event: "unpipe",listener: (src: stream.Readable) => void,): this
Jump to headingprependListener(event: "streamClosed",listener: (code: number) => void,): this
Jump to headingprependListener(event: "timeout",listener: () => void,): this
Jump to headingprependListener(event: "trailers",listener: (trailers: IncomingHttpHeaders,flags: number,) => void,): this
Jump to headingprependListener(event: "wantTrailers",listener: () => void,): this
Jump to headingprependListener(event: string | symbol,listener: (...args: any[]) => void,): this
Jump to headingprependOnceListener(event: "aborted",listener: () => void,): this
Jump to headingprependOnceListener(event: "close",listener: () => void,): this
Jump to headingprependOnceListener(event: "data",listener: (chunk: Buffer | string) => void,): this
Jump to headingprependOnceListener(event: "drain",listener: () => void,): this
Jump to headingprependOnceListener(event: "end",listener: () => void,): this
Jump to headingprependOnceListener(event: "error",listener: (err: Error) => void,): this
Jump to headingprependOnceListener(event: "finish",listener: () => void,): this
Jump to headingprependOnceListener(event: "frameError",listener: (frameType: number,errorCode: number,) => void,): this
Jump to headingprependOnceListener(event: "pipe",listener: (src: stream.Readable) => void,): this
Jump to headingprependOnceListener(event: "unpipe",listener: (src: stream.Readable) => void,): this
Jump to headingprependOnceListener(event: "streamClosed",listener: (code: number) => void,): this
Jump to headingprependOnceListener(event: "timeout",listener: () => void,): this
Jump to headingprependOnceListener(event: "trailers",listener: (trailers: IncomingHttpHeaders,flags: number,) => void,): this
Jump to headingprependOnceListener(event: "wantTrailers",listener: () => void,): this
Jump to headingprependOnceListener(event: string | symbol,listener: (...args: any[]) => void,): this