You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
478 B

#!/usr/bin/env node
'use strict';
var $ = require('preconditions').singleton();
var io = require('socket.io');
var log = require('npmlog');
log.debug = log.verbose;
var DEFAULT_PORT = 3380;
var opts = {
port: parseInt(process.argv[2]) || DEFAULT_PORT,
};
var server = io(opts.port);
server.on('connection', function(socket) {
socket.on('msg', function(data) {
server.emit('msg', data);
});
});
console.log('Message broker server listening on port ' + opts.port)