fix(console) chat do not broadcast

This commit is contained in:
coderaiser 2014-01-31 07:29:53 -05:00
parent 4d09a99857
commit 0a231b2692
2 changed files with 11 additions and 4 deletions

View file

@ -53,8 +53,12 @@
var ret;
ret = socket.on('connection', function(clientSocket) {
onConnection(clientSocket, function(json) {
onConnection(clientSocket, function(json, all) {
var msg = Util.stringifyJSON(json);
if (all)
socket.send(msg, clientSocket, 'message', all);
socket.send(msg, clientSocket);
});
});
@ -171,7 +175,7 @@
Util.exec(callback, {
stdout: pCommand
});
}, true);
} else if (WIN32 || firstChar === ' ' || isContain)
exec(pCommand, options, lExec_func);
else

View file

@ -26,8 +26,11 @@
CloudFunc.removeListener(name, func, AllListeners, socket);
}
function send(msg, clientSocket) {
clientSocket.send(msg);
function send(msg, clientSocket, channel, all) {
if (all && channel)
clientSocket.broadcast.emit(channel, msg);
else
clientSocket.send(msg);
}
/**