redis-commander icon indicating copy to clipboard operation
redis-commander copied to clipboard

When Subscribing: "ERROR: Connection in subscriber mode, only subscriber commands may be used"

Open dlbrown06 opened this issue 6 years ago • 4 comments

I'm getting this error continuously when I try to SUBSCRIBE [channel] to a channel that I know exists from PUBSUB CHANNELS.

Anyone have any idea why I'm getting this error when using the CLI from the redis commander GUI?

dlbrown06 avatar Sep 10 '19 17:09 dlbrown06

SUBSCRIBE needs special handling not done inside redis commander command line right now

see description at the redis driver https://github.com/luin/ioredis#pubsub

sseide avatar Sep 11 '19 10:09 sseide

related to #337 booth need extra Redis connections to handle multi command and subscribe Need to rewrite connection handling to support these features...

sseide avatar Oct 09 '19 13:10 sseide

We need to create two Redis clients. One for getting and setting key-value pairs and another one for pubsub commands.

const redis = new Redis({
  host: process.env.REDIS_HOST,
  port: Number(process.env.REDIS_PORT),

});

const redisForSub = new Redis({
  host: process.env.REDIS_HOST,
  port: Number(process.env.REDIS_PORT),
});

We need to create two Redis clients. One for getting and setting key-value pairs and another one for pubsub commands.

const redis = new Redis({
  host: process.env.REDIS_HOST,
  port: Number(process.env.REDIS_PORT),

});

const redisForSub = new Redis({
  host: process.env.REDIS_HOST,
  port: Number(process.env.REDIS_PORT),
});

Should their port and host be different?

samansayar avatar Dec 10 '23 15:12 samansayar