code: func (c *wsClient) outHandler() {
  out:
  	for {
  		// Send any messages ready for send until the quit channel is
  		// closed.
  		select {
  		case r := <-c.sendChan:
  			err := c.conn.WriteMessage(websocket.TextMessage, r.msg)
  			if err != nil {
  				c.Disconnect()
  				break out
  			}
  			if r.doneChan != nil {
  				r.doneChan <- true
  			}
  
  		case <-c.quit:
  			break out
  		}
  	}
  
  	// Drain any wait channels before exiting so nothing is left waiting
  	// around to send.
  cleanup:
  	for {
  		select {
  		case r := <-c.sendChan:
  			if r.doneChan != nil {
  				r.doneChan <- false
  			}
  		default:
  			break cleanup
  		}
  	}
  	c.wg.Done()
  	rpcsLog.Tracef("Websocket client output handler done for %s", c.addr)
  }
docs: // outHandler handles all outgoing messages for the websocket connection.  It
  // must be run as a goroutine.  It uses a buffered channel to serialize output
  // messages while allowing the sender to continue running asynchronously.  It
  // must be run as a goroutine.