lib/index.js
function Server(srv, opts){
  if (!(this instanceof Server)) return new Server(srv, opts);
  if ('object' == typeof srv && srv instanceof Object && !srv.listen) {
    opts = srv;
    srv = null;
  }
  opts = opts || {};
  this.nsps = {};
  this.parentNsps = new Map();
  this.path(opts.path || '/socket.io');
  this.serveClient(false !== opts.serveClient);
  this.parser = opts.parser || parser;
  this.encoder = new this.parser.Encoder();
  this.adapter(opts.adapter || Adapter);
  this.origins(opts.origins || '*:*');
  this.sockets = this.of('/');
  if (srv) this.attach(srv, opts);
}
function Server(srv, opts){
  if (!(this instanceof Server)) return new Server(srv, opts);
  if ('object' == typeof srv && srv instanceof Object && !srv.listen) {
    opts = srv;
    srv = null;
  }
  opts = opts || {};
  this.nsps = {};
  this.parentNsps = new Map();
  this.path(opts.path || '/socket.io');
  this.serveClient(false !== opts.serveClient);
  this.parser = opts.parser || parser;
  this.encoder = new this.parser.Encoder();
  this.adapter(opts.adapter || Adapter);
  this.origins(opts.origins || '*:*');
  this.sockets = this.of('/');
  if (srv) this.attach(srv, opts);
}
function Server ( srv , opts ) { if ( ! ( this instanceof Server ) ) return new Server ( srv , opts ) ; if ( 'object' == typeof srv && srv instanceof Object && ! srv . listen ) { opts = srv ; srv = null ; } opts = opts || { } ; this . nsps = { } ; this . parentNsps = new Map ( ) ; this . path ( opts . path || '/socket.io' ) ; this . serveClient ( false !== opts . serveClient ) ; this . parser = opts . parser || parser ; this . encoder = new this . parser . Encoder ( ) ; this . adapter ( opts . adapter || Adapter ) ; this . origins ( opts . origins || '*:*' ) ; this . sockets = this . of ( '/' ) ; if ( srv ) this . attach ( srv , opts ) ; }
Server constructor.

@param {http.Server|Number|Object} srv http server, port or options
@param {Object} [opts]
@api public
Server constructor .