constructor(registry, broker, opts) {
		super(registry, broker, opts);

		this.opts = _.defaultsDeep(opts, {
			sampleCount: 5,
			lowLatency: 10,
			collectCount: 5,
			pingInterval: 10
		});

		this.brokerStopped = false;

		this.hostAvgLatency = new Map();

		/* hostMap contains:
			hostname => {
				historicLatency: [],
				nodeList: []
			}
		*/
		this.hostMap = new Map();

		// short circuit
		if (!this.broker.transit) return;

		if (this.broker.localBus.listenerCount("$node.latencyMaster") === 0) {
			// claim as master
			this.broker.localBus.on("$node.latencyMaster", function () {});
			// respond to PONG
			this.broker.localBus.on("$node.pong", this.processPong.bind(this));
			// dynamically add new node
			this.broker.localBus.on("$node.connected", this.addNode.bind(this));
			// dynamically remove node
			this.broker.localBus.on("$node.disconnected", this.removeHostMap.bind(this));
			// try to discovery all nodes on start up
			this.broker.localBus.on("$broker.started", this.discovery.bind(this));
			// clean up ourselves
			this.broker.localBus.on("$broker.stopped", () => (this.brokerStopped = true));
		} else {
			// remove node if we are told by master
			this.broker.localBus.on(
				"$node.latencySlave.removeHost",
				this.removeHostLatency.bind(this)
			);
		}

		this.broker.localBus.on("$node.latencySlave", this.updateLatency.bind(this));
	}
Lowest latency invocation strategy

Since Strategy can be instantiated multiple times, therefore,
we need to have a "master" instance to send ping, and each
individual "slave" instance will update their list dynamically

These options can be configured in broker registry options:

const broker = new ServiceBroker({
	logger: true,
	registry: {
		strategy: "LatencyStrategy",
		strategyOptions: {
			sampleCount: 5,
			lowLatency: 10,
			collectCount: 5,
			pingInterval: 10
		}
	}
});

@class LatencyStrategy