From 8b036091d9c3d816f21270888d0e22ea95d23d11 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 1b0d44a70586a3..c8aeb7ac899c76 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -272,12 +272,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'