You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Convert pub/sub channel names into strings.
This commit is contained in:
6
index.js
6
index.js
@@ -455,9 +455,9 @@ RedisClient.prototype.return_reply = function (reply) {
|
||||
var type = reply[0].toString();
|
||||
|
||||
if (type === "message") {
|
||||
this.emit("message", reply[1], reply[2]); // channel, message
|
||||
this.emit("message", reply[1].toString(), reply[2]); // channel, message
|
||||
} else if (type === "pmessage") {
|
||||
this.emit("pmessage", reply[1], reply[2], reply[3]); // pattern, channel, message
|
||||
this.emit("pmessage", reply[1].toString(), reply[2].toString(), reply[3]); // pattern, channel, message
|
||||
} else if (type === "subscribe" || type === "unsubscribe" || type === "psubscribe" || type === "punsubscribe") {
|
||||
if (reply[2] === 0) {
|
||||
this.subscriptions = false;
|
||||
@@ -465,7 +465,7 @@ RedisClient.prototype.return_reply = function (reply) {
|
||||
console.log("All subscriptions removed, exiting pub/sub mode");
|
||||
}
|
||||
}
|
||||
this.emit(type, reply[1], reply[2]); // channel, count
|
||||
this.emit(type, reply[1].toString(), reply[2]); // channel, count
|
||||
} else {
|
||||
throw new Error("subscriptions are active but got unknown reply type " + type);
|
||||
}
|
||||
|
Reference in New Issue
Block a user