title: Ensuring a unique socket.id over multiple app instances using socket.io
body: <p>I am running a Node.js + Socket.io app over multiple instances with a Redis cache layer. I am wondering if the socket.id field for each connection would be unique over all instances. Is there a possibility that a socket.id on one instance can be the same as socket.id on another instance?</p>
  
  <p>As far as I can see, the socket.id is generated using the following code:</p>
  
  <pre><code>/**
   * Interface to a `Client` for a given `Namespace`.
   *
   * @param {Namespace} nsp
   * @param {Client} client
   * @api public
   */
  
  function Socket(nsp, client, query){
    this.nsp = nsp;
    this.server = nsp.server;
    this.adapter = this.nsp.adapter;
    this.id = nsp.name !== '/' ? nsp.name + '#' + client.id : client.id;
    this.client = client;
    this.conn = client.conn;
    this.rooms = {};
    this.acks = {};
    this.connected = true;
    this.disconnected = false;
    this.handshake = this.buildHandshake(query);
    this.fns = [];
  }
  </code></pre>
  
  <p>I am unsure about what it is actually doing when creating the id field.</p>