code: func (c *Client) sendRequest(jReq *jsonRequest) {
  	// Choose which marshal and send function to use depending on whether
  	// the client running in HTTP POST mode or not.  When running in HTTP
  	// POST mode, the command is issued via an HTTP client.  Otherwise,
  	// the command is issued via the asynchronous websocket channels.
  	if c.config.HTTPPostMode {
  		c.sendPost(jReq)
  		return
  	}
  
  	// Check whether the websocket connection has never been established,
  	// in which case the handler goroutines are not running.
  	select {
  	case <-c.connEstablished:
  	default:
  		jReq.responseChan <- &response{err: ErrClientNotConnected}
  		return
  	}
  
  	// Add the request to the internal tracking map so the response from the
  	// remote server can be properly detected and routed to the response
  	// channel.  Then send the marshalled request via the websocket
  	// connection.
  	if err := c.addRequest(jReq); err != nil {
  		jReq.responseChan <- &response{err: err}
  		return
  	}
  	log.Tracef("Sending command [%s] with id %d", jReq.method, jReq.id)
  	c.sendMessage(jReq.marshalledJSON)
  }
docs: // sendRequest sends the passed json request to the associated server using the
  // provided response channel for the reply.  It handles both websocket and HTTP
  // POST mode depending on the configuration of the client.