Hi All,
I am using the MQTT library on an Argon for local communication between several devices(Raspberry Pi, Particle Argon, and M5 core2 - which is an ESP32).
I am interested in identifying my MQTT broker by its local hostname instead of IP address, as I currently do. This will help me when I move the system from one location to another, as I shouldn't have to code the new IP Address of the MQTT broker and reflash the firmware onsite.
Can anyone assist me with getting the syntax right to access by hostname? I use the hostname on other devices or on an MQTT explorer without issue, so I think it's probably doable and that I'm just not doing it right.
I can get the MQTT broker to connect if I use the IP Address:
byte server = { 10,0,0,200 };
MQTT client(server, 1883, callback);
or if I use a remote broker:
MQTT client("mqtt.eclipse.org", 1883, callback);
But I cannot get it to connect to using my local hostname:
MQTT client("raspberrypimqtt.local", 1883, callback);