agent/tcs/client/client.go
func (cs *clientServer) Serve() error {
	seelog.Debug("TCS client starting websocket poll loop")
	if !cs.IsReady() {
		return fmt.Errorf("tcs client: websocket not ready for connections")
	}

	if cs.statsEngine == nil {
		return fmt.Errorf("tcs client: uninitialized stats engine")
	}

	// Start the timer function to publish metrics to the backend.
	cs.publishTicker = time.NewTicker(cs.publishMetricsInterval)
	cs.publishHealthTicker = time.NewTicker(cs.publishMetricsInterval)

	if !cs.disableResourceMetrics {
		go cs.publishMetrics()
	}
	go cs.publishHealthMetrics()

	return cs.ConsumeMessages()
}
func (cs *clientServer) Serve() error {
	seelog.Debug("TCS client starting websocket poll loop")
	if !cs.IsReady() {
		return fmt.Errorf("tcs client: websocket not ready for connections")
	}

	if cs.statsEngine == nil {
		return fmt.Errorf("tcs client: uninitialized stats engine")
	}

	// Start the timer function to publish metrics to the backend.
	cs.publishTicker = time.NewTicker(cs.publishMetricsInterval)
	cs.publishHealthTicker = time.NewTicker(cs.publishMetricsInterval)

	if !cs.disableResourceMetrics {
		go cs.publishMetrics()
	}
	go cs.publishHealthMetrics()

	return cs.ConsumeMessages()
}
func ( cs * clientServer ) Serve ( ) error { seelog . Debug ( " " ) if ! cs . IsReady ( ) { return fmt . Errorf ( " " ) } if cs . statsEngine == nil { return fmt . Errorf ( " " ) } // Start the timer function to publish metrics to the backend. cs . publishTicker = time . NewTicker ( cs . publishMetricsInterval ) cs . publishHealthTicker = time . NewTicker ( cs . publishMetricsInterval ) if ! cs . disableResourceMetrics { go cs . publishMetrics ( ) } go cs . publishHealthMetrics ( ) return cs . ConsumeMessages ( ) }
// Serve begins serving requests using previously registered handlers (see
// AddRequestHandler). All request handlers should be added prior to making this
// call as unhandled requests will be discarded.
Serve begins serving requests using previously registered handlers ( see AddRequestHandler ) . All request handlers should be added prior to making this call as unhandled requests will be discarded .