Sha256: 8a3bde9dad3ad93c380c9dcf4f29a5123d19b0a8b73929e225c24c608b1a92cd

Contents?: true

Size: 1.01 KB

Versions: 33

Compression:

Stored size: 1.01 KB

Contents

var redis = require("redis"),
    client1 = redis.createClient(),
    client2 = redis.createClient(),
    client3 = redis.createClient(),
    client4 = redis.createClient(),
    msg_count = 0;

redis.debug_mode = false;

client1.on("psubscribe", function (pattern, count) {
    console.log("client1 psubscribed to " + pattern + ", " + count + " total subscriptions");
    client2.publish("channeltwo", "Me!");
    client3.publish("channelthree", "Me too!");
    client4.publish("channelfour", "And me too!");
});

client1.on("punsubscribe", function (pattern, count) {
    console.log("client1 punsubscribed from " + pattern + ", " + count + " total subscriptions");
    client4.end();
    client3.end();
    client2.end();
    client1.end();
});

client1.on("pmessage", function (pattern, channel, message) {
    console.log("("+  pattern +")" + " client1 received message on " + channel + ": " + message);
    msg_count += 1;
    if (msg_count === 3) {
        client1.punsubscribe();
    }
});

client1.psubscribe("channel*");

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/socket.io/node_modules/redis/examples/psubscribe.js
express_translate-1.0.13 node_modules/redis/examples/psubscribe.js
express_translate-1.0.12 node_modules/redis/examples/psubscribe.js
express_translate-1.0.11 node_modules/redis/examples/psubscribe.js