authenticateSocket (credentials, socket, emit) {
    return new Promise((resolve, reject) => {
      const timeout = setTimeout(() => {
        debug('authenticateSocket timed out');
        reject(new Error('Authentication timed out'));
      }, this.options.timeout);

      debug('Attempting to authenticate socket');
      socket[emit]('authenticate', credentials, (error, data) => {
        if (error) {
          return reject(error);
        }

        clearTimeout(timeout);
        socket.authenticated = true;
        debug('Socket authenticated!');

        resolve(data);
      });
    });
  }
// Returns a promise that authenticates a socket
Returns a promise that authenticates a socket
Returns a promise that authenticates a socket
authenticateSocket (credentials, socket, emit) {
    return new Promise((resolve, reject) => {
      const timeout = setTimeout(() => {
        debug('authenticateSocket timed out');
        reject(new Error('Authentication timed out'));
      }, this.options.timeout);
      debug('Attempting to authenticate socket');
      socket[emit]('authenticate', credentials, (error, data) => {
        if (error) {
          return reject(error);
        }
        clearTimeout(timeout);
        socket.authenticated = true;
        debug('Socket authenticated!');
        resolve(data);
      });
    });
  }
authenticateSocket ( credentials , socket , emit ) { return new Promise ( ( resolve , reject ) => { const timeout = setTimeout ( ( ) => { debug ( 'authenticateSocket timed out' ) ; reject ( new Error ( 'Authentication timed out' ) ) ; } , this . options . timeout ) ; debug ( 'Attempting to authenticate socket' ) ; socket [ emit ] ( 'authenticate' , credentials , ( error , data ) => { if ( error ) { return reject ( error ) ; } clearTimeout ( timeout ) ; socket . authenticated = true ; debug ( 'Socket authenticated!' ) ; resolve ( data ) ; } ) ; } ) ; }
Returns a promise that authenticates a socket
Returns a promise that authenticates a socket