Add support for Redis 7's sharded pubsub commands
As I understand, there is no difference between the MESSAGEs sent to subscribers from PUBLISH or SPUBLISH commands. Both send this to subscribers:
1) MESSAGE
2) <channel_name>
3) <message_data>
So if you use hiredis to SUBSCRIBE and also SSUBSCRIBE to channel "foo", when messages arrive it will be impossible to tell if it came from the sharded or the regular channel. While the pubsub and sharde-pubsub keyspaces are non-overlapping on the server-side, the protocol's failure to distinguish between the source of the message overlaps the keyspaces for the client.
By the way, I initially implemented this with a separate sub.sharded_channels dictionary for SSUBSCRIBE commands, but only later realized there's no way to actually route messages to the sub.channels or sub.sharded_channels dictionary on a given channel name.
As I understand, there is no difference between the
MESSAGEs sent to subscribers fromPUBLISHorSPUBLISHcommands.
Ah, you are right! That's an interesting twist..
There are ongoing discussions regarding this problem in https://github.com/redis/redis/issues/10748
Oh boy. Well, in the meantime, the official C library does not support the official API.