make sure the sessionID target is right

pull/1607/head
John McLear 2013-03-19 16:21:04 +00:00
parent d0e656d0a6
commit 2916b39c24
1 changed files with 8 additions and 3 deletions

View File

@ -156,7 +156,6 @@ exports.handleMessage = function(client, message)
// handleMessage will be called, even if the client is not authorized
hooks.aCallAll("handleMessage", { client: client, message: message }, function ( err, messages ) {
if(ERR(err, callback)) return;
_.each(messages, function(newMessage){
if ( newMessage === null ) {
dropMessage = true;
@ -193,6 +192,7 @@ exports.handleMessage = function(client, message)
handleSuggestUserName(client, message);
} else {
messageLogger.warn("Dropped message, unknown COLLABROOM Data Type " + message.data.type);
console.warn(message);
}
} else {
messageLogger.warn("Dropped message, unknown Message Type " + message.type);
@ -261,9 +261,12 @@ function handleSaveRevisionMessage(client, message){
* @param sessionID {string} the socketIO session to which we're sending this message
*/
exports.handleCustomObjectMessage = function (msg, sessionID, cb) {
if(msg.type === "CUSTOM"){
if(msg.data.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
console.warn("Sent msg", msg);
console.warn("to sessionID", sessionID);
// socketio.clients[sessionID].send(msg);
socketio.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
}
@ -1496,3 +1499,5 @@ exports.padUsers = function (padID, callback) {
callback(null, {padUsers: result});
});
}
exports.sessioninfos = sessioninfos;