code: func (c *Client) doDisconnect() bool {
  	if c.config.HTTPPostMode {
  		return false
  	}
  
  	c.mtx.Lock()
  	defer c.mtx.Unlock()
  
  	// Nothing to do if already disconnected.
  	if c.disconnected {
  		return false
  	}
  
  	log.Tracef("Disconnecting RPC client %s", c.config.Host)
  	close(c.disconnect)
  	if c.wsConn != nil {
  		c.wsConn.Close()
  	}
  	c.disconnected = true
  	return true
  }
docs: // doDisconnect disconnects the websocket associated with the client if it
  // hasn't already been disconnected.  It will return false if the disconnect is
  // not needed or the client is running in HTTP POST mode.
  //
  // This function is safe for concurrent access.