redis-online
v1.0.1
Published
Node redis user online/offline tracker
Downloads
95
Readme
redis-online
Node redis online/offline tracker. Using this approach - link
Usage
First install
npm install redis-online
var options = {
redisUrl: 'redis://localhost:6379'
};
var tracker = require('redis-online');
tracker.init(options);
// ...
// periodically (once per minute) call the route for every online user
// from the browser f. e.
router.post('/api/online', function(req, res){
// get userId from session
tracker.setOnline(userId);
res.json(true);
});
// get list of online users
router.get('/api/online', function(req, res){
tracker.getOnline(function(err, userIds){
res.json(userIds);
});
});