raumstatus/node/test.js
Lucas Pleß db915edefc fixed storing user count in redis (thx badboy_)
made user count api working and added data to graph
2013-10-22 14:01:50 +02:00

30 lines
No EOL
554 B
JavaScript

var moment = require("moment");
var redis = require("redis");
var redisClient = redis.createClient();
redisClient.on("connect", function () {
console.log("connected to redis");
redisClient.zrangebyscore('onlinecount', "-inf", "+inf", function(err, replies) {
var data = [];
replies.forEach(function (reply, i) {
var line = reply.split('|');
data.push( { at: moment(parseInt(line[0])).format(), value: line[1] });
});
console.log(data);
redisClient.quit();
});
});