docs: function Socket(uri, opts){
    if (!(this instanceof Socket)) return new Socket(uri, opts);
  
    opts = opts || {};
  
    if ('object' == typeof uri) {
      opts = uri;
      uri = null;
    }
  
    if (uri) {
      uri = util.parseUri(uri);
      opts.host = uri.host;
      opts.secure = uri.protocol == 'https' || uri.protocol == 'wss';
      opts.port = uri.port;
      if (uri.query) opts.query = uri.query;
    }
  
    this.secure = null != opts.secure ? opts.secure :
      (global.location && 'https:' == location.protocol);
  
    if (opts.host) {
      var pieces = opts.host.split(':');
      opts.hostname = pieces.shift();
      if (pieces.length) opts.port = pieces.pop();
    }
  
    this.hostname = opts.hostname ||
      (global.location ? location.hostname : 'localhost');
    this.port = opts.port || (global.location && location.port ?
         location.port :
         (this.secure ? 443 : 80));
    this.query = opts.query || {};
    if ('string' == typeof this.query) this.query = util.qsParse(this.query);
    this.upgrade = false !== opts.upgrade;
    this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
    this.forceJSONP = !!opts.forceJSONP;
    this.timestampParam = opts.timestampParam || 't';
    this.timestampRequests = !!opts.timestampRequests;
    this.flashPath = opts.flashPath || '';
    this.transports = opts.transports || ['polling', 'websocket', 'flashsocket'];
    this.readyState = '';
    this.writeBuffer = [];
    this.callbackBuffer = [];
    this.policyPort = opts.policyPort || 843;
    this.open();
  
    Socket.sockets.push(this);
    Socket.sockets.evs.emit('add', this);
  }