1.0.1 • Published 2 years ago

redis-online v1.0.1

Weekly downloads
307
License
MIT
Repository
-
Last release
2 years ago

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);
  });
  
});
1.0.1

2 years ago

1.0.0

8 years ago

0.0.4

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago