socket.io-redis-adapter: Unhandled error event
Hey, I implemented a redis adapter in this way
var socketioPub = m_redis.createClient(null, null, { detect_buffers: true });
socketioPub.on('error', function (err) { ... });
var socketioSub = m_redis.createClient(null, null, { detect_buffers: true });
socketioSub.on('error', function (err) { ... });
io.adapter(m_socketio_redis({ pubClient: socketioPub, subClient: socketioSub }));
So if the redis server e.g. is not running I can handle that error, but I get an unhandled error event from https://github.com/Automattic/socket.io-redis/blob/master/index.js#L73
[...]
function Redis(nsp){
Adapter.call(this, nsp);
var self = this;
sub.psubscribe(prefix + '#*', function(err){
if (err) self.emit('error', err); <--------------------------------
});
sub.on('pmessage', this.onmessage.bind(this));
}
[...]
because there is no event listener attached and I see no way to attach one from the outside. Any ideas?
Best regards!
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 21 (3 by maintainers)
You can access to an adapter instance like:
Putting a listener on adapter.prototype actually works… That’s far from intuitive… Example: