Last active
December 16, 2019 10:58
-
-
Save akmalhazim/57ee5284dcaf1c12e364d20b2474cf8c to your computer and use it in GitHub Desktop.
CoteJS performance test
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
const cote = require('cote'); | |
const requester = new cote.Requester({ | |
name: 'test caller', | |
key: 'test' | |
}); | |
const responder = new cote.Responder({ | |
name: 'test responder', | |
key: 'test' | |
}); | |
responder.on('ping', (req, cb) => { | |
cb(null, 'pong'); | |
}); | |
async function makeRequest() { | |
console.log('Running'); | |
const start = new Date(); | |
const response = await requester.send({ type: 'ping' }); | |
const end = new Date() - start; | |
console.info('Execution time: %dms', end); | |
console.log(response); | |
}; | |
makeRequest() | |
setInterval(makeRequest, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment