Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var ipc = require('node-ipc');
var crypto = require('crypto');
var cs = require('../../../lib/crypto-service');
ipc.config.silent = true;
var password = "a1b2c3d4";
var secret = "";
ipc.serveNet('127.0.0.1', 4895, function() {
ipc.server.on('PROBE:MSG', function(data, socket) {
ipc.server.emit(socket, "ALIVE:MSG", {});
});
ipc.server.on('MONITOR:MSG', function(msg, socket) {
console.log(msg.data.line);
socket.destroy();
ipc.server.stop();
});
ipc.server.on('KLYNG:MSG', function(msg, socket) {
console.log(msg.data);
socket.destroy();
ipc.server.stop();
});
var ipc = require('node-ipc');
ipc.config.silent = true;
ipc.serveNet('127.0.0.1', 4895, function() {
ipc.server.on('MONITOR:MSG', function(msg, socket) {
console.log(msg.data.line);
socket.destroy();
ipc.server.stop();
});
ipc.server.on('KLYNG:MSG', function(msg, socket) {
console.log(msg.data);
socket.destroy();
ipc.server.stop();
})
});
ipc.server.start();
var klyngMsgPromise = new Promise(function(resolve, reject) {
ipc.serveNet('127.0.0.1', 9876, function() {
ipc.server.on('KLYNG:MSG', function(msg, socket) {
try {
expect(msg.header.from).to.equal(1);
expect(msg.header.to).to.equal(0);
expect(msg.data).to.equal("Weee!");
resolve();
}
catch(err) { reject(err); }
});
});
ipc.server.start();
});
startServer: function () {
ipc.config.id = this.serverName;
ipc.serveNet(this.host, this.port, function () {
ipc.server.on('dispatch', function (data) {
ipc.server.broadcast(data.room, data.message);
});
}.bind(this));
ipc.server.start();
},