Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hostname for the MQTT broker IP #1039

Open
SteveRMann opened this issue Dec 11, 2023 · 2 comments
Open

Use hostname for the MQTT broker IP #1039

SteveRMann opened this issue Dec 11, 2023 · 2 comments

Comments

@SteveRMann
Copy link

I need to move my MQTT server to a new IP. The reason why is irrelevant. If I could use the MDNS location for the broker in client.setserver(), a change in my broker IP would be trivial.

Instead of
client.setServer("192.168.1.120", 1883);

I would like to be able to:
client.setServer("broker.local", 1883);

@lee32768
Copy link

I've been looking for a "nslookup" type command for the ESP32 to work around this, but hostname is the correct solution.

@ChuckMash
Copy link

ChuckMash commented Dec 24, 2023

Looks like this is already supported anywhere you would be setting an IP, just set the domain instead.

https://github.com/knolleary/pubsubclient/blob/master/src/PubSubClient.cpp#L118-L127
https://github.com/knolleary/pubsubclient/blob/master/src/PubSubClient.cpp#L715-L719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants