more crash fixes to socketS

v1.18.x
Baris Soner Usakli 11 years ago
parent ba8e98520c
commit 6da6baa213

@ -140,8 +140,11 @@ Sockets.init = function() {
});
}
if(!payload.name) {
return winston.warn('[socket.io] Empty method name');
}
var parts = payload.name.split('.'),
var parts = payload.name.toString().split('.'),
namespace = parts.slice(0, 1),
methodToCall = parts.reduce(function(prev, cur) {
if (prev !== null && prev[cur]) {
@ -151,7 +154,9 @@ Sockets.init = function() {
}
}, Namespaces);
if (methodToCall !== null) {
if(!methodToCall) {
return winston.warn('[socket.io] Unrecognized message: ' + payload.name);
}
if (Namespaces[namespace].before) {
Namespaces[namespace].before(socket, function() {
@ -160,9 +165,6 @@ Sockets.init = function() {
} else {
callMethod(methodToCall);
}
} else {
winston.warn('[socket.io] Unrecognized message: ' + payload.name);
}
});
});
};

Loading…
Cancel
Save