diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index e44ced051..b254053d9 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -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, {}); } diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index 941491237..ff3604192 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -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;