node-redis-pubsub
node-redis-pubsub copied to clipboard
PUBLISH from redis not captured
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 ?
Could you post the code you're using to pub and sub from the cli?