Skip to content

Commit c3d9000

Browse files
addaleaxtargos
authored andcommitted
doc: document http2 network error behaviour
Fixes: #21836 PR-URL: #21861 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent eea199b commit c3d9000

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/api/http2.md

+5
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,17 @@ server.on('stream', (stream, headers) => {
271271
'content-type': 'text/html',
272272
':status': 200
273273
});
274+
stream.on('error', (error) => console.error(error));
274275
stream.end('<h1>Hello World</h1>');
275276
});
276277

277278
server.listen(80);
278279
```
279280

281+
Even though HTTP/2 streams and network sockets are not in a 1:1 correspondence,
282+
a network error will destroy each individual stream and must be handled on the
283+
stream level, as shown above.
284+
280285
#### Event: 'timeout'
281286
<!-- YAML
282287
added: v8.4.0

0 commit comments

Comments
 (0)