I have created two lists on Redis database I intend to read data from them using lPop and insert using rPush. I am using Node-Redis driver to connect to Redis and do operations below is my code
const redis = require('redis');
const https = require('https')
const client = redis.createClient({
host: 'host',
port: 6379,
password: 'pwd'
});
const main = async() => {
console.log('starting app..');
client.on('error', err => {
console.log('Error ' + err);
return;
});
await client.connect();
client.lPop('Response',(err,msg) => {
console.log('Received on Response :' + msg); // 'message'
});
// this is for testing purpose
const testMsg = {
"id": "77777",
"operation": "create_acc",
"success": "true",
"explorerUrl": "url"
};
await client.rPush('Response',JSON.stringify(testMsg));
}
I setup the callback on lPop and then pushing data using rPop at the bottom . I am able to receive this data using redid-cli commands but not using the code above. That is when at the bottom part rPush pushes the data which is received on CLI using LPOP command but in above code the lPop callbacks aren’t working
Please suggest whats missing.