How can I subscribe to all available channels?

I'm writing a nodejs redis client.

How can I subscribe to all available channels on a redis server?

I can successfully listen to a channel by doing:

var rclient = redis.createClient();
rclient.subscribe('test');

rclient.on("message", function (channel, message) {
    console.log('Got message from ' + channel);
};

but if I try to use a pattern:

rclient.psubscribe('test')

or:

rclient.psubscribe('*')

I get no messages. Am I doing it wrong?

It turned out that there is a special event:

rclient.on("pmessage", function (pattern, channel, message) {
    console.log('Got message from ' + channel);
};

Record all channels on your server as they are created then subscribe to all of them in one go using :

var channels = ['test','foo','bar']

client.subscribe(channels);