MESSAGE does not include original pattern.

2 views
Skip to first unread message

Brian Hammond

unread,
Apr 2, 2010, 3:57:59 PM4/2/10
to Redis Clients Development
Client A issues psubscribe chan-*

Client B issues publish chan-foo hello

Redis forwards the published message to client A

Client A receives *3<CRLF>$7<CRLF>message<CRLF>$8<CRLF>chan-foo<CRLF>
$5<CRLF>hello<CRLF>

The problem is that the pattern (chan-*) is missing.

This means Client A must replicate the logic of matching the channel
to the original pattern in order to call the correct callback
function. If the client defers it such that there is but a single
"onMessage" callback, well, that's not interesting.

Perhaps consider that the "message" multi-bulk reply should contain
both the channel published on and the pattern the client psubscribed
to?

*4<CRLF>$7<CRLF>message<CRLF>$8<CRLF>chan-foo<CRLF>$6<CRLF>chan-*<CRLF>
$5<CRLF>hello<CRLF>

The client could spot this by *4 (cf. *3) when the first bulk reply
inside the multi bulk reply is "message".

Thoughts?

Brian Hammond

unread,
Apr 2, 2010, 4:35:18 PM4/2/10
to Redis Clients Development
In case this is shot down, I *think* this is what Redis does. Yes?

http://gist.github.com/353672

Reply all
Reply to author
Forward
0 new messages