Skip to content
This repository was archived by the owner on Jul 6, 2018. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions doc/http2-implementation-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,16 @@ const server = http2.createSecureServer(options, (req, res) => {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely best to leave out the changes to this file... these implementation notes are out of date and will be replaced entirely very soon by proper documentation.

res.writeHead(200, {'content-type': 'text/html'});

const favicon = res.createPushResponse();
favicon.path = '/favicon.ico';
favicon.push((req, res) => {
res.setHeader('content-type', 'image/jpeg');
fs.createReadStream('/some/image.jpg').pipe(res);
const favicon = res.createPushRequest({':path': '/favicon.ico'});
favicon.push((err, res) => {
res.setHeader('content-type', 'image/png');
fs.createReadStream('/some/logo.png').pipe(res);
});

const pushResponse = res.createPushResponse();
pushResponse.path = '/image.jpg';
pushResponse.push((req, res) => {
const pushResponse = res.createPushRequest({':path': '/image.jpg'});
pushResponse.push((err, res) => {
res.setHeader('content-type', 'image/jpeg');
fs.createReadStream('/some/image/jpg').pipe(res);
fs.createReadStream('/some/image.jpg').pipe(res);
});

res.end('<html><head><link rel="preload" href="/favicon.ico"/></head>' +
Expand Down Expand Up @@ -299,7 +297,7 @@ The `'rst-stream'` event is emitted when a RST-STREAM frame is received.
### Method: `response.writeHeader(statusCode, headers)`
### Method: `response.write()`
### Method: `response.end()`
### Method: `response.createPushResponse()`
### Method: `response.createPushRequest(headers)`

## HTTP2.createServerSession(options)

Expand Down
Loading