-
Notifications
You must be signed in to change notification settings - Fork 1.2k
psubscribe patterns not working correctly? #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When you psubscribe, the messages are returned with three patterns - channel, pattern, and message. Try this:
|
@klinquist, good catch! But alas, the 'message' event isn't even firing. I checked redis and the channel is definitely being published. |
@saschaishikawa Oh yes, one more thing... when you psubscribe, you need to watch for pmessage instead of message. redis.on('pmessage', function(channel, pattern, message) {}); :) |
🤦 That takes care of it. Thank you very much for your help and contribution to ioredis. It's been very useful. :) Closing issue now. |
if everyone comes after the order has changed: |
I'm trying to publish status messages for each process that gets forked within a script. Each channel is named as
status_
followed by some unique identifier,job_id
. So I was hoping to usepsubscribe
to subscribe to all channels matching the patternstatus_*
, but I'm having trouble doing so. It seems to work OK if I replace the call toredis.psubscribe
with a regularredis.subscribe
and hard-code the correct channel name, but that defeats the purpose.Then, on another script, I publish a message to the channel
The text was updated successfully, but these errors were encountered: