Skip to content

Commit

Permalink
doc: update pushStream docs to use err first
Browse files Browse the repository at this point in the history
Refs: #17406 (comment)

Backport-PR-URL: #20456
PR-URL: #18088
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
  • Loading branch information
jasnell authored and MylesBorins committed May 2, 2018
1 parent 3cd2054 commit d9d0d0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -1174,14 +1174,16 @@ added: v8.4.0
* Returns: {undefined}

Initiates a push stream. The callback is invoked with the new `Http2Stream`
instance created for the push stream.
instance created for the push stream passed as the second argument, or an
`Error` passed as the first argument.

```js
const http2 = require('http2');
const server = http2.createServer();
server.on('stream', (stream) => {
stream.respond({ ':status': 200 });
stream.pushStream({ ':path': '/' }, (pushStream) => {
stream.pushStream({ ':path': '/' }, (err, pushStream) => {
if (err) throw err;
pushStream.respond({ ':status': 200 });
pushStream.end('some pushed data');
});
Expand Down

0 comments on commit d9d0d0e

Please sign in to comment.