code: func (c *Client) wsInHandler() {
  out:
  	for {
  		// Break out of the loop once the shutdown channel has been
  		// closed.  Use a non-blocking select here so we fall through
  		// otherwise.
  		select {
  		case <-c.shutdown:
  			break out
  		default:
  		}
  
  		_, msg, err := c.wsConn.ReadMessage()
  		if err != nil {
  			// Log the error if it's not due to disconnecting.
  			if c.shouldLogReadError(err) {
  				log.Errorf("Websocket receive error from "+
  					"%s: %v", c.config.Host, err)
  			}
  			break out
  		}
  		c.handleMessage(msg)
  	}
  
  	// Ensure the connection is closed.
  	c.Disconnect()
  	c.wg.Done()
  	log.Tracef("RPC client input handler done for %s", c.config.Host)
  }
docs: // wsInHandler handles all incoming messages for the websocket connection
  // associated with the client.  It must be run as a goroutine.