code: function Server(options, requestListener) {
    if (!(this instanceof Server)) {
      return new Server(options, requestListener);
    }
    
      if (typeof options === 'function') {
        requestListener = options;
        options = {};
      } else if (options == null || typeof options === 'object') {
        options = util._extend({}, options);
      }
    
      options = Object.assign({
        server: null,
        token: null,
        id: null,
      }, options);
  
    if (!isDefinedAndNonNull(options, 'server')) {
      throw new TypeError('\'server\' must be provided');
    }
  
    if (!isDefinedAndNonNull(options, 'token')) {
      throw new TypeError('A \'token\' string or function must be provided');
    }
  
    var self = this;
  
    this.listenUri = options.server;
    if (isDefinedAndNonNull(options, 'id')) {
      this.listenUri = listenUri + '&id=' + options.id;
    }
  
    this.pendingRequest = null;
    this.closeRequested = false;
    this.options = options;
    this.path = options.path;
    this.clients = [];
  
    if (requestListener) {
      this.on('request', requestListener);
    }
    this.timeout = 2 * 60 * 1000;
    this.keepAliveTimeout = 5000;
    this.on('requestchannel', function(channel) { requestChannelListener(self, channel) });
  
  }
docs: WebSocket Server implementation