a safer approach I think but still be careful
This commit is contained in:
parent
ac9b972358
commit
13ad46aa67
|
@ -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, {});
|
||||
}
|
||||
|
||||
|
|
|
@ -278,8 +278,9 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
if (!getSocket()) return;
|
||||
if (!evt.data) return;
|
||||
var wrapper = evt;
|
||||
if (wrapper.type != "COLLABROOM") return;
|
||||
if (wrapper.type != "COLLABROOM" && wrapper.type != "CUSTOM") return;
|
||||
var msg = wrapper.data;
|
||||
|
||||
if (msg.type == "NEW_CHANGES")
|
||||
{
|
||||
var newRev = msg.newRev;
|
||||
|
@ -390,6 +391,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
callbacks.onUserLeave(userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
else if (msg.type == "DISCONNECT_REASON")
|
||||
{
|
||||
appLevelDisconnectReason = msg.reason;
|
||||
|
|
Loading…
Reference in New Issue