code: func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error) {
  	// Either open a websocket connection or create an HTTP client depending
  	// on the HTTP POST mode.  Also, set the notification handlers to nil
  	// when running in HTTP POST mode.
  	var wsConn *websocket.Conn
  	var httpClient *http.Client
  	connEstablished := make(chan struct{})
  	var start bool
  	if config.HTTPPostMode {
  		ntfnHandlers = nil
  		start = true
  
  		var err error
  		httpClient, err = newHTTPClient(config)
  		if err != nil {
  			return nil, err
  		}
  	} else {
  		if !config.DisableConnectOnNew {
  			var err error
  			wsConn, err = dial(config)
  			if err != nil {
  				return nil, err
  			}
  			start = true
  		}
  	}
  
  	client := &Client{
  		config:          config,
  		wsConn:          wsConn,
  		httpClient:      httpClient,
  		requestMap:      make(map[uint64]*list.Element),
  		requestList:     list.New(),
  		ntfnHandlers:    ntfnHandlers,
  		ntfnState:       newNotificationState(),
  		sendChan:        make(chan []byte, sendBufferSize),
  		sendPostChan:    make(chan *sendPostDetails, sendPostBufferSize),
  		connEstablished: connEstablished,
  		disconnect:      make(chan struct{}),
  		shutdown:        make(chan struct{}),
  	}
  
  	if start {
  		log.Infof("Established connection to RPC server %s",
  			config.Host)
  		close(connEstablished)
  		client.start()
  		if !client.config.HTTPPostMode && !client.config.DisableAutoReconnect {
  			client.wg.Add(1)
  			go client.wsReconnectHandler()
  		}
  	}
  
  	return client, nil
  }
docs: // New creates a new RPC client based on the provided connection configuration
  // details.  The notification handlers parameter may be nil if you are not
  // interested in receiving notifications and will be ignored if the
  // configuration is set to run in HTTP POST mode.