src/events/ReconnectingWebSocket.js
/**
   * Websocket 'error' handler that attempts to reconnect if reconnect is
   * enabled. Otherwise, it only feeds the 'error' that occurred back up
   * the chain and closes the connection.
   *
   * @private
   */
Websocket 'error' handler that attempts to reconnect if reconnect is
enabled. Otherwise, it only feeds the 'error' that occurred back up
the chain and closes the connection.

@private
Websocket ' error ' handler that attempts to reconnect if reconnect is enabled . Otherwise it only feeds the ' error ' that occurred back up the chain and closes the connection . @private
handleError(err) {
    debug("an error occurred.", err);
    if (!this._reconnect) {
      this.emit("error", err);
      this.close();
      return;
    }
    this.emit("disconnected", { reason: "error", err });
    debug("attempting to reconnect");
    this.connect((err) => {
      if (err) {
        this.emit("error", err);
        this.close();
        return;
      }
      this.emit("reconnected");
    });
  }
handleError ( err ) { debug ( "an error occurred." , err ) ; if ( ! this . _reconnect ) { this . emit ( "error" , err ) ; this . close ( ) ; return ; } this . emit ( "disconnected" , { reason : "error" , err } ) ; debug ( "attempting to reconnect" ) ; this . connect ( ( err ) => { if ( err ) { this . emit ( "error" , err ) ; this . close ( ) ; return ; } this . emit ( "reconnected" ) ; } ) ; }
Websocket 'error' handler that attempts to reconnect if reconnect is
 enabled.
Websocket ' error ' handler that attempts to reconnect if reconnect is enabled .