Update socketcluster

This commit is contained in:
Zalmoxisus 2016-01-27 18:00:19 +02:00
parent e484258b3f
commit 4731265628
2 changed files with 5 additions and 3 deletions

View File

@ -17,11 +17,13 @@ module.exports.run = function(worker) {
res.send('OK');
});
scServer.addMiddleware(scServer.MIDDLEWARE_EMIT, function (socket, channel, data, next) {
scServer.addMiddleware(scServer.MIDDLEWARE_EMIT, function (req, next) {
var channel = req.event;
var data = req.data;
if (channel.substr(0, 3) === 'sc-' || channel === 'respond' || channel === 'log') {
scServer.exchange.publish(channel, data);
} else if (channel === 'log-noid') {
scServer.exchange.publish('log', { id: socket.id, data: data });
scServer.exchange.publish('log', { id: req.socket.id, data: data });
}
next();
});

View File

@ -25,6 +25,6 @@
"dependencies": {
"express": "^4.13.3",
"minimist": "^1.2.0",
"socketcluster": "^3.0.0"
"socketcluster": "^4.3.1"
}
}