Skip to content

Node.js based forum software built for the modern web

testing 2

barisusaklie00124007fd8
diff --git a/src/socket.io/index.js b/src/socket.io/index.js
index d85053e2cb..8dc75a4b77 100644
--- a/src/socket.io/index.js
+++ b/src/socket.io/index.js
@@ -27,11 +27,22 @@ var io;
Sockets.init = function(server) {
+ var RedisStore = require('socket.io/lib/stores/redis'),
+ redis = require('redis'),
+ pub = redis.createClient(),
+ sub = redis.createClient(),
+ client = redis.createClient();
+
io = socketioWildcard(SocketIO).listen(server, {
log: false,
transports: ['websocket', 'xhr-polling', 'jsonp-polling', 'flashsocket'],
'browser client minification': true,
- resource: nconf.get('relative_path') + '/socket.io'
+ resource: nconf.get('relative_path') + '/socket.io',
+ 'store' : new RedisStore({
+ redisPub : pub,
+ redisSub : sub,
+ redisClient : client
+ }),
});
Sockets.server = io;
@@ -280,13 +291,15 @@ Sockets.isUsersOnline = function(uids, callback) {
return callback(null, []);
}
- sockets = sockets.map(function(s) {
- return s.uid;
- });
+ sockets = sockets.map(function(s) {
+ return s.uid;
+ });
- callback(null, uids.map(function(uid) {
+ var data = uids.map(function(uid) {
return sockets.indexOf(parseInt(uid, 10)) !== -1;
- }));
+ });
+
+ callback(null, data);
};
Sockets.updateRoomBrowsingText = updateRoomBrowsingText;