Skip to content

Instantly share code, notes, and snippets.

@akmalhazim
Last active December 16, 2019 10:58
Show Gist options
  • Save akmalhazim/57ee5284dcaf1c12e364d20b2474cf8c to your computer and use it in GitHub Desktop.
Save akmalhazim/57ee5284dcaf1c12e364d20b2474cf8c to your computer and use it in GitHub Desktop.
CoteJS performance test
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