ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

keyPrefix appears to not work with `subscribe`

Open ThisIsMissEm opened this issue 1 year ago • 4 comments

The documentation implies that the keyPrefix option should work for subscribe and publish, but in practice, it seems to not.

Screenshot 2024-08-27 at 23 24 14

As you can see, the set commands are correctly prefixed, but the subscribe commands aren't.

ThisIsMissEm avatar Aug 27 '24 21:08 ThisIsMissEm

This also applies to unsubscribe

ThisIsMissEm avatar Aug 27 '24 21:08 ThisIsMissEm

We've stumbled across this issue at work when using the library and were wondering if it is relevant and whether we can contribute?

BrendMU avatar May 06 '25 22:05 BrendMU

Turns out the reason it doesn't work as one might expect is because pubsub actually doesn't use "keys" but "channels" and these are different according to redis, so arguably, there'd need to be a channelPrefix option that does the exact same thing but for pubsub.

ThisIsMissEm avatar May 06 '25 22:05 ThisIsMissEm

I understand. Will adding the channelPrefix be beneficial and should we contribute to it?

BrendMU avatar May 07 '25 17:05 BrendMU