Thursday, April 7, 2016

Redis command to list all subscribers subscribed to redis channel

Leave a Comment

Below command only gives channel list .

127.0.0.1:6379> PUBSUB CHANNELS 1) "mychannel" 2) "mychanne2" 

How to LIST subscribers subscribed on channel1 OR channel2 .?

also

i din't found redis command to list all subscribers Of a particular channel

1 Answers

Answers 1

I can achieve this with something like:

redis_client.multi().client(['list']).exec(function(err, results) {   var pairs = results[0].split(' ');   pairs.forEach(function(pair){     var kv = pair.split('=');     if (kv[0] == 'name' && kv[1] == constants.REDIS_SUBSCRIBER_NAME)       found = true;   });   if (found) // some logic   else // some logic }); 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment