gfvalvo:
As written, your question makes no sense. The name of the object you're instantiating ('GardenClient2' in this case) no longer exists after the compiler / linker have done their jobs. It's just collection of memory locations in the processor. So, no matter what you call them, each new board will have a "different copy".
If that's not what you meant, try phrasing your question better.
No, you have it correct, and that's what I thought- that the compiled code would be different on different boards.
If I use the same constructor as shown, on two different boards, the MQTT broker will only handle messages from one board.
I asked Nick O'Leary this a year ago, and his response (if I recall accurately) was that the client ID had to be unique on the network.
Further research into the broker, From: MqttClient
"A client identifier clientId must be specified and be less that 65535 characters. It must be unique across all clients connecting to the same server. The clientId is used by the server to store data related to the client, hence it is important that the clientId remain the same when connecting to a server if durable subscriptions or reliable messaging are required."
So, yes, the constructor in this line is lost after compile
WiFiClient GardenClient2;
But the documentation for pubsub says that the client ID has to be the same as the constructor:
PubSubClient client(GardenClient2);
But, unique on the network.
So, I was wondering if anyone had found a workaround for this.