-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion/Question: Wouldn't be better to use ioredis instead of redis package? #60
Comments
I am using ioredis with this package. There was a small monkey-patch I had to do to ioredis to make it work. ioredis returns buffers via pmessageBuffer instead of pmessage. The snippet below is a hack I used on the sub instance to make work with socket.io-redis. The return_buffers and detect_buffers flags are not needed. While more direct support of ioredis (which is much more current and actively maintainted) would be nice, this seems to be sufficient for my applicaiton's needs. // WARNING: Use of this will prevent message and pmessage handlers from being unregistered
// since our stub method will be registered instead...
var oldOn = redisClient.on;
redisClient.on = function(event, oldListener) {
var self = this;
switch (event) {
case "pmessage":
return oldOn("pmessageBuffer", function() {
if (arguments.length > 1) arguments[1] = arguments[1].toString();
return oldListener.apply(self, arguments);
});
case "message":
return oldOn("messageBuffer", function() {
if (arguments.length) arguments[0] = arguments[0].toString();
return oldListener.apply(self, arguments);
});
default: return oldOn.apply(self, arguments);
}
} |
Any Update ? |
Closed by #95. |
ioredis seem to perform far better then redis
(https://github.com/luin/ioredis)
The text was updated successfully, but these errors were encountered: