merged master

This commit is contained in:
Baris Usakli
2013-12-05 14:57:18 -05:00
9 changed files with 136 additions and 79 deletions

View File

@@ -61,7 +61,6 @@ websockets.init = function(io) {
var hs = socket.handshake,
sessionID, uid, lastPostTime = 0;
// Validate the session, if present
socketCookieParser(hs, {}, function(err) {
sessionID = socket.handshake.signedCookies["express.sid"];
@@ -104,8 +103,6 @@ websockets.init = function(io) {
});
});
socket.on('disconnect', function() {
var index = userSockets[uid].indexOf(socket);
@@ -868,6 +865,12 @@ websockets.init = function(io) {
});
});
socket.on('api:unread.count', function(callback) {
topics.getUnreadTids(uid, 0, 19, function(err, tids) {
socket.emit('event:unread.updateCount', tids.length);
});
});
socket.on('api:category.loadMore', function(data, callback) {
var start = data.after,
end = start + 9;
@@ -1137,6 +1140,10 @@ websockets.init = function(io) {
websockets.in = function(room) {
return io.sockets.in(room);
};
websockets.getConnectedClients = function() {
return userSockets;
}
}
})(module.exports);