a safer approach I think but still be careful

This commit is contained in:
John McLear 2013-03-16 13:19:12 +00:00
parent ac9b972358
commit 13ad46aa67
2 changed files with 9 additions and 6 deletions

View file

@ -261,12 +261,13 @@ function handleSaveRevisionMessage(client, message){
* @param sessionID {string} the socketIO session to which we're sending this message
*/
exports.handleCustomObjectMessage = function (msg, sessionID, cb) {
if(sessionID){ // If a sessionID is targeted then send directly to this sessionID
io.sockets.socket(sessionID).emit(msg); // send a targeted message
}else{
socketio.sockets.in(msg.data.padId).json.send(msg); // broadcast to all clients on this pad
if(msg.type === "CUSTOM"){
if(sessionID){ // If a sessionID is targeted then send directly to this sessionID
io.sockets.socket(sessionID).emit(msg); // send a targeted message
}else{
socketio.sockets.in(msg.data.padId).json.send(msg); // broadcast to all clients on this pad
}
}
cb(null, {});
}