Skip to content

Commit

Permalink
doc: document http2 network error behaviour
Browse files Browse the repository at this point in the history
Fixes: nodejs#21836

PR-URL: nodejs#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]>
  • Loading branch information
addaleax committed Jul 23, 2018
1 parent daa15b5 commit 0e4cbde
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,17 @@ server.on('stream', (stream, headers) => {
'content-type': 'text/html',
':status': 200
});
stream.on('error', (error) => console.error(error));
stream.end('<h1>Hello World</h1>');
});

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'
<!-- YAML
added: v8.4.0
Expand Down

0 comments on commit 0e4cbde

Please sign in to comment.