Skip to content

Unhandled error event #21

@mathiask88

Description

@mathiask88

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions