Created
September 15, 2017 09:08
-
-
Save apapirovski/fa1da19f0c88ea45cc317c40760e51e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const h2 = require('http2'); | |
const server = h2.createServer(); | |
server.on('request', (req, res) => res.end()); | |
server.on('timeout', () => console.log('timeout')); | |
server.listen(0, () => { | |
const port = server.address().port; | |
const url = `http://localhost:${port}`; | |
const client = h2.connect(url); | |
makeReq(); | |
function makeReq() { | |
console.log('heartbeat'); | |
const request = client.request({ | |
':path': '/foobar', | |
':method': 'GET', | |
':scheme': 'http', | |
':authority': `localhost:${port}`, | |
}); | |
request.end(); | |
setTimeout(makeReq, 60000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment