const Redis = require(‘ioredis’);
const sub = new Redis();const pub = new Redis();
sub.on(‘subscribe’,(channel,count)=> { console.log(“Subbed to channel:”+ channel);})
sub.on( ‘信息’ …
试试这样:
sub.subscribe(channel, (error, count) => { if (error) { throw new Error(error); } console.log(`Subscribed to ${count} channel. Listening for updates on the ${channel} channel.`); });