removed getUserSockets for chat

emit to users rooms directly
v1.18.x
barisusakli 11 years ago
parent 999da9183d
commit fdafb72c34

@ -106,7 +106,7 @@ Loader.init = function() {
silent: true silent: true
}); });
for(var x=0;x<numCPUs;x++) { for(var x=0;x<4;x++) {
// Only the first worker sets up templates/sounds/jobs/etc // Only the first worker sets up templates/sounds/jobs/etc
cluster.fork({ cluster_setup: x === 0 }); cluster.fork({ cluster_setup: x === 0 });
} }

@ -204,24 +204,20 @@ SocketModules.chats.send = function(socket, data, callback) {
// Recipient // Recipient
SocketModules.chats.pushUnreadCount(touid); SocketModules.chats.pushUnreadCount(touid);
server.getUserSockets(touid).forEach(function(s) { server.in('uid_' + touid).emit('event:chats.receive', {
s.emit('event:chats.receive', {
withUid: socket.uid, withUid: socket.uid,
message: message, message: message,
self: 0 self: 0
}); });
});
// Sender // Sender
SocketModules.chats.pushUnreadCount(socket.uid); SocketModules.chats.pushUnreadCount(socket.uid);
server.getUserSockets(socket.uid).forEach(function(s) { server.in('uid_' + socket.uid).emit('event:chats.receive', {
s.emit('event:chats.receive', {
withUid: touid, withUid: touid,
message: message, message: message,
self: 1 self: 1
}); });
}); });
});
}; };
function sendChatNotification(fromuid, touid, messageObj) { function sendChatNotification(fromuid, touid, messageObj) {
@ -246,9 +242,7 @@ SocketModules.chats.pushUnreadCount = function(uid) {
if (err) { if (err) {
return; return;
} }
server.getUserSockets(uid).forEach(function(s) { server.in('uid_' + uid).emit('event:unread.updateChatCount', null, unreadCount);
s.emit('event:unread.updateChatCount', null, unreadCount);
});
}); });
}; };

Loading…
Cancel
Save