node-redis-pubsub icon indicating copy to clipboard operation
node-redis-pubsub copied to clipboard

PUBLISH from redis not captured

Open devtoro opened this issue 7 years ago • 1 comments

Hello!

So I was fooling around with REDIS and node-redis-pubsub. I started two redis-cli instances locally and ran two node scripts like the above:

var NRP = require('node-redis-pubsub');

var nrpConfig = {
  port: 6379,
  host: '127.0.0.1'
};

var nrp = new NRP(nrpConfig); // This is the NRP client

console.log("Listening to channel test");


nrp.on(
  'test',
  function(data){
    console.log('DATA RECEIVED: ' + data);
  }
);

In one redis-cli, I subscribed to channel test

From the other I publish to channel test and see the results ONLY IN THE REDIS CLI SUBSCRIBED INSTANCE, but nothing happens from the script. If I publish to the same channel from node environment, the script suddenly works and I see the published message.

Any clues why this might be happening ?

devtoro avatar Jan 26 '18 09:01 devtoro

Could you post the code you're using to pub and sub from the cli?

RangerMauve avatar Jan 26 '18 15:01 RangerMauve