redis-online

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i redis-online

Weekly Downloads

39

Version

1.0.1

License

MIT

Unpacked Size

4.03 kB

Total Files

3

Last publish

Collaborators

  • zag2art