Adapter code that allows the CometD client JavaScript library to run in a NodeJS environment.
npm install cometd-nodejs-client
// Run the adapter code.
require('cometd-nodejs-client').adapt();
// Your normal CometD client application here.
See here for an example CometD client application.