agent/tcs/client/client.go
func New(url string,
	cfg *config.Config,
	credentialProvider *credentials.Credentials,
	statsEngine stats.Engine,
	publishMetricsInterval time.Duration,
	rwTimeout time.Duration,
	disableResourceMetrics bool) wsclient.ClientServer {
	cs := &clientServer{
		statsEngine:            statsEngine,
		publishTicker:          nil,
		publishHealthTicker:    nil,
		publishMetricsInterval: publishMetricsInterval,
	}
	cs.URL = url
	cs.AgentConfig = cfg
	cs.CredentialProvider = credentialProvider
	cs.ServiceError = &tcsError{}
	cs.RequestHandlers = make(map[string]wsclient.RequestHandler)
	cs.MakeRequestHook = signRequestFunc(url, cs.AgentConfig.AWSRegion, credentialProvider)
	cs.TypeDecoder = NewTCSDecoder()
	cs.RWTimeout = rwTimeout
	cs.disableResourceMetrics = disableResourceMetrics
	// TODO make this context inherited from the handler
	cs.ctx, cs.cancel = context.WithCancel(context.TODO())
	return cs
}
func New(url string,
	cfg *config.Config,
	credentialProvider *credentials.Credentials,
	statsEngine stats.Engine,
	publishMetricsInterval time.Duration,
	rwTimeout time.Duration,
	disableResourceMetrics bool) wsclient.ClientServer {
	cs := &clientServer{
		statsEngine:            statsEngine,
		publishTicker:          nil,
		publishHealthTicker:    nil,
		publishMetricsInterval: publishMetricsInterval,
	}
	cs.URL = url
	cs.AgentConfig = cfg
	cs.CredentialProvider = credentialProvider
	cs.ServiceError = &tcsError{}
	cs.RequestHandlers = make(map[string]wsclient.RequestHandler)
	cs.MakeRequestHook = signRequestFunc(url, cs.AgentConfig.AWSRegion, credentialProvider)
	cs.TypeDecoder = NewTCSDecoder()
	cs.RWTimeout = rwTimeout
	cs.disableResourceMetrics = disableResourceMetrics
	// TODO make this context inherited from the handler
	cs.ctx, cs.cancel = context.WithCancel(context.TODO())
	return cs
}
// New returns a client/server to bidirectionally communicate with the backend.
// The returned struct should have both 'Connect' and 'Serve' called upon it
// before being used.