fixed active users socket calls in ACP

This commit is contained in:
Julian Lam
2014-01-13 12:01:42 -05:00
parent 3fb44d7693
commit aa689a7a29
4 changed files with 42 additions and 19 deletions

View File

@@ -130,6 +130,7 @@ Sockets.init = function() {
} else {
// Deconstruct the message
var parts = payload.name.slice(4).split('.'),
namespace = parts.slice(0, 1),
methodToCall = parts.reduce(function(prev, cur) {
if (prev !== null && prev[cur]) {
return prev[cur];
@@ -157,8 +158,15 @@ Sockets.init = function() {
}
socketArgs.push(sessionData);
// Call the requested method
if (Namespaces[namespace].before) {
Namespaces[namespace].before(sessionData, function() {
methodToCall.apply(Namespaces, socketArgs);
});
} else {
methodToCall.apply(Namespaces, socketArgs);
}
// winston.info('[socket.io] Executing: ' + payload.name);
methodToCall.apply(Namespaces, socketArgs);
} else {
winston.warn('[socket.io] Unrecognized message: ' + payload.name);
}