Closed
Description
iosredis added the ssubscribe support https://github.com/luin/ioredis/pull/1690/files
but their API is ssubscribe
rather than sSubscribe
, same with the sPublish
vs spublish
.
TypeError: this.subClient.sSubscribe is not a function
I believe we might need to have the workaround like this
const isRedisV4 = typeof this.pubClient.pSubscribe === "function";
if (isRedisV4) {
this.redisListeners.set("psub", (msg, channel) => {
this.onmessage(null, channel, msg);
});
this.redisListeners.set("sub", (msg, channel) => {
this.onrequest(channel, msg);
});
this.subClient.pSubscribe(
this.channel + "*",
this.redisListeners.get("psub"),
true
);
this.subClient.subscribe(
[
this.requestChannel,
this.responseChannel,
this.specificResponseChannel,
],
this.redisListeners.get("sub"),
true
);
} else {
this.redisListeners.set("pmessageBuffer", this.onmessage.bind(this));
this.redisListeners.set("messageBuffer", this.onrequest.bind(this));
this.subClient.psubscribe(this.channel + "*");
this.subClient.on(
"pmessageBuffer",
this.redisListeners.get("pmessageBuffer")
);
this.subClient.subscribe([
this.requestChannel,
this.responseChannel,
this.specificResponseChannel,
]);
this.subClient.on(
"messageBuffer",
this.redisListeners.get("messageBuffer")
);
}
Metadata
Metadata
Assignees
Labels
No labels