Skip to content

Why add subscription for each room? #102

Closed
@2fours

Description

@2fours

Trying to migrate from 0.9x to 1.x. There was a massive issue in 0.9x where 5 extra channels would be subscribed to in redis each time a new client connected: socketio/socket.io#1371

Looking at the code for socket.io-redis it seems like a similar problem is going to occur as each client creates a new subscription for the room.

 Redis.prototype.add = function(id, room, fn){
    debug('adding %s to %s ', id, room);
    var self = this;
    Adapter.prototype.add.call(this, id, room);
    var channel = prefix + '#' + this.nsp.name + '#' + room + '#';
    sub.subscribe(channel, function(err){
      if (err) {
        self.emit('error', err);
        if (fn) fn(err);
        return;
      }
      if (fn) fn(null);
    });
  };

Once we start getting into thousands of concurrent connections how is this not going to be an issue again? Am I missing something? Wouldn't it be better to just subscribe once for each redis client and do the multiplexing in code rather than via redis subscribe/unsubscribe?

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