code: func (c *Client) Connect(tries int) error {
  	c.mtx.Lock()
  	defer c.mtx.Unlock()
  
  	if c.config.HTTPPostMode {
  		return ErrNotWebsocketClient
  	}
  	if c.wsConn != nil {
  		return ErrClientAlreadyConnected
  	}
  
  	// Begin connection attempts.  Increase the backoff after each failed
  	// attempt, up to a maximum of one minute.
  	var err error
  	var backoff time.Duration
  	for i := 0; tries == 0 || i < tries; i++ {
  		var wsConn *websocket.Conn
  		wsConn, err = dial(c.config)
  		if err != nil {
  			backoff = connectionRetryInterval * time.Duration(i+1)
  			if backoff > time.Minute {
  				backoff = time.Minute
  			}
  			time.Sleep(backoff)
  			continue
  		}
  
  		// Connection was established.  Set the websocket connection
  		// member of the client and start the goroutines necessary
  		// to run the client.
  		log.Infof("Established connection to RPC server %s",
  			c.config.Host)
  		c.wsConn = wsConn
  		close(c.connEstablished)
  		c.start()
  		if !c.config.DisableAutoReconnect {
  			c.wg.Add(1)
  			go c.wsReconnectHandler()
  		}
  		return nil
  	}
  
  	// All connection attempts failed, so return the last error.
  	return err
  }
docs: // Connect establishes the initial websocket connection.  This is necessary when
  // a client was created after setting the DisableConnectOnNew field of the
  // Config struct.
  //
  // Up to tries number of connections (each after an increasing backoff) will
  // be tried if the connection can not be established.  The special value of 0
  // indicates an unlimited number of connection attempts.
  //
  // This method will error if the client is not configured for websockets, if the
  // connection has already been established, or if none of the connection
  // attempts were successful.