mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
removed getUserSockets for chat
emit to users rooms directly
This commit is contained in:
@@ -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,22 +204,18 @@ 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
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -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);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user