var redis = require('redis');
var redisClient = redis.createClient({host : 'localhost', port : 6379});
var x = redisClient.pubsub.channels //Cuz this is similar to PUBSUB CHANNELS
console.log(x);
The above code returns 'undefined' even when there are channels on my redis server. I'm I using it correctly? If so, is there any other way to access channels available on the redis server.
I'm using the 'redis' package.
You need to use send_command
as the PUBSUB
command isn't directly supported by the driver:
redisClient.send_command('PUBSUB', [ 'CHANNELS' ], function(err, channels) {
if (err) {
console.log('Received an error:', err);
} else {
console.log('Channels:', channels);
}
});