mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closed #652
This commit is contained in:
@@ -77,6 +77,8 @@ var socket,
|
|||||||
}
|
}
|
||||||
app.enterRoom(room, true);
|
app.enterRoom(room, true);
|
||||||
|
|
||||||
|
socket.emit('reconnected');
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
reconnectEl.removeClass('active');
|
reconnectEl.removeClass('active');
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|||||||
@@ -867,7 +867,6 @@ var bcrypt = require('bcrypt'),
|
|||||||
|
|
||||||
User.pushNotifCount = function(uid) {
|
User.pushNotifCount = function(uid) {
|
||||||
User.notifications.getUnreadCount(uid, function(err, count) {
|
User.notifications.getUnreadCount(uid, function(err, count) {
|
||||||
console.log('unread count is', count);
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
websockets.in('uid_' + uid).emit('event:notifications.updateCount', count);
|
websockets.in('uid_' + uid).emit('event:notifications.updateCount', count);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -135,6 +135,21 @@ websockets.init = function(io) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('reconnected', function() {
|
||||||
|
if (uid) {
|
||||||
|
topics.pushUnreadCount(uid);
|
||||||
|
user.pushNotifCount(uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
if (uid) {
|
||||||
|
winston.info('[socket] uid ' + uid + ' (' + sessionID + ') has successfully reconnected.');
|
||||||
|
} else {
|
||||||
|
winston.info('[socket] An anonymous user (' + sessionID + ') has successfully reconnected.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
socket.on('api:get_all_rooms', function(data) {
|
socket.on('api:get_all_rooms', function(data) {
|
||||||
socket.emit('api:get_all_rooms', io.sockets.manager.rooms);
|
socket.emit('api:get_all_rooms', io.sockets.manager.rooms);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user