code: func (c *Client) wsOutHandler() {
  out:
  	for {
  		// Send any messages ready for send until the client is
  		// disconnected closed.
  		select {
  		case msg := <-c.sendChan:
  			err := c.wsConn.WriteMessage(websocket.TextMessage, msg)
  			if err != nil {
  				c.Disconnect()
  				break out
  			}
  
  		case <-c.disconnectChan():
  			break out
  		}
  	}
  
  	// Drain any channels before exiting so nothing is left waiting around
  	// to send.
  cleanup:
  	for {
  		select {
  		case <-c.sendChan:
  		default:
  			break cleanup
  		}
  	}
  	c.wg.Done()
  	log.Tracef("RPC client output handler done for %s", c.config.Host)
  }
docs: // wsOutHandler handles all outgoing messages for the websocket connection.  It
  // uses a buffered channel to serialize output messages while allowing the
  // sender to continue running asynchronously.  It must be run as a goroutine.