aboutsummaryrefslogtreecommitdiffstats
path: root/signaling-server/node_modules/socket.io/node_modules/redis/benches/reconnect_test.js
blob: 7abdd516651e28d4cc40f95ef02678f1f3f71bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var redis = require("../index").createClient(null, null, {
//    max_attempts: 4
});

redis.on("error", function (err) {
    console.log("Redis says: " + err);
});

redis.on("ready", function () {
    console.log("Redis ready.");
});

redis.on("reconnecting", function (arg) {
    console.log("Redis reconnecting: " + JSON.stringify(arg));
});
redis.on("connect", function () {
    console.log("Redis connected.");
});

setInterval(function () {
    var now = Date.now();
    redis.set("now", now, function (err, res) {
        if (err) {
            console.log(now + " Redis reply error: " + err);
        } else {
            console.log(now + " Redis reply: " + res);
        }
    });
}, 100);