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

Connectivity issue when using broker on local IP #214

Open
peterbraden opened this issue Oct 14, 2022 · 2 comments
Open

Connectivity issue when using broker on local IP #214

peterbraden opened this issue Oct 14, 2022 · 2 comments

Comments

@peterbraden
Copy link

When using a local broker with an IP rather than a hostname, I experienced an inability to connect (error code -1). Using a different MQTT library with exactly the same connection settings and credentials worked perfectly.

Unfortunately, even when enabling the debug settings, I didn't get any more information to help diagnose - client->connect returned 0 in connectServer, but I didn't get any deeper into diagnosis.

  • Arduino board: ESP32

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.0.0

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

Connect to a broker on a local IP (ie. "192.168.0.12", port "1883").

@jeffmcfadden
Copy link

I am currently running into the exact same issue. Which other MQTT library(ies) worked for you?

@Nistp
Copy link

Nistp commented Feb 9, 2023

@jeffmcfadden did you try passing in the IP address as in XXX.XXX.XXX.XXX (not a string!) or an actual 'servername', as in "http://XXX.XXX.XXX.XXX/"?

Edit: checked again, the Adafruit MQTT library currently does not support IP addresses (passing in XXX.XXX.XXX.XXX) as how they are defined in the Arduino ESP32. The best options are to either try passing in "http(s)//XXX.XXX.XXX.XXX/" or assignning a name to the device on your DNS server or using a different library.

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