mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
fix(console) chat do not broadcast
This commit is contained in:
parent
4d09a99857
commit
0a231b2692
2 changed files with 11 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue