From c3d9000111127608fdd175e087c33440b6805e1b Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 17 Jul 2018 23:55:45 +0200 Subject: [PATCH] doc: document http2 network error behaviour Fixes: https://github.com/nodejs/node/issues/21836 PR-URL: https://github.com/nodejs/node/pull/21861 Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca Reviewed-By: Minwoo Jung --- doc/api/http2.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/http2.md b/doc/api/http2.md index 0cc4d073a06975..f24e13eeb03309 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -271,12 +271,17 @@ server.on('stream', (stream, headers) => { 'content-type': 'text/html', ':status': 200 }); + stream.on('error', (error) => console.error(error)); stream.end('

Hello World

'); }); server.listen(80); ``` +Even though HTTP/2 streams and network sockets are not in a 1:1 correspondence, +a network error will destroy each individual stream and must be handled on the +stream level, as shown above. + #### Event: 'timeout'