carlos8f / haredis

High-availability redis in Node.js.
https://npmjs.org/package/haredis
154 stars 21 forks source link

Does haredis support psubscribe / pmessage? #23

Open vladminsky opened 10 years ago

vladminsky commented 10 years ago

Hi,

I didn't find an explicit reference in documentation on the topic so decided to post you an issue.

It looks like haredis doesn't support psubscribe / on("pmessage") mechanism.

Here is a sample:


var redis = require('haredis');
var channelClient = redis.createClient('XX.XX.XX.XX:YYYY');
channelClient.debug_mode = true;

channelClient.on('message', console.log.bind(console, 'message:'));
channelClient.on('pmessage', console.log.bind(console, 'pmessage:'));

channelClient.subscribe('sample', function (err) {});
channelClient.psubscribe('*', function (err) {});

setInterval(channelClient.publish.bind(channelClient, 'sample', 1), 3000);

Result is:

message: sample 1
message: sample 1
. . .
message: sample 1
. . .

When it is running only subscribe / message approach is executed while subscribe by pattern doesn't look work at all.

I apologize in advance in case I missed something or use the lib incorrectly.

Thank you!

codebudo commented 10 years ago

Ah! I've been having this same issue. I'm glad it's not just me.