-
Notifications
You must be signed in to change notification settings - Fork 51
Broker hostname needs to start with http or https otherwise an error is raised #25
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
Comments
Yep, I updated the code to avoid the user from having to set their Will look into this, assigned. |
Another user hit this; they specified a numeric IP Adafruit_CircuitPython_MiniMQTT/adafruit_minimqtt.py Lines 122 to 125 in dd1e3f2
|
Hello! I'm the user that Dan H just mentioned. I think in trying to make it easier for beginners, we may have made it more difficult for advanced users who know that MQTT is not HTTP or HTTPS. I would never have dreamed that I'd have had to put in http or https in my broker address, but then again, I'm a network engineer. Also, I think it's wrong to teach beginners this particular syntax -- when they go to start using other products that use MQTT, they're going to have the the reverse of the surprise I had today. I personally am okay with inputting the IP Address or FQDN and relying on the is_ssl option to determine if the port is 1833 or 8833 unless a custom port number attribute is defined. |
@brendannm720 @jimbobbennett OK, I agree with both of these points. Thanks for the further clarification and both of your opinions on this. I'll be looking at MiniMQTT this upcoming week with cellular sockets, will roll back to relying on the |
issue #26 and this issue is the same. one self.broker = _the_interface.unpretty_ip returns 4 octets, but the remainder of the code expects a string.. I would just remove that try/except block. also you next issue will be down in connect in the first try block. in the except block it doesn't handle just a xx.xx.xx.xx for broker. so i would just check for '/' there and not do the split. Now the assumption is proto, as its not specified, do you default HTTP? Ive played around and got both xxx.xx.xx.xx and my reconnect issue working by just that little change. |
I also think proto should be saved as it will be needed during reconnect. reconnect will need proto, port, path, and broker as they were already parsed out. |
Fix Hostname Issue (adafruit#25)
I'm working against the latest version of this with the breaking changes from #21. I've made the required changes to set the socket and changed the call to
__init__
.I'm hitting a bug with connecting. When I call
connect
I get an error:Digging into the code I see this at line 215:
It looks like the code is checking for
http://
orhttps://
at the start of the broker name, and using this to get the port. This looks wrong to me:__init__
so there is no need to look it up.http://
or 'https://`, so this code will always throw an error.My workaround is to manually prepend
https://
to my broker name, which is less than ideal.Looking at the previous version of the code, this wasn't there and there was no checking for the port, assuming the user had set it. I guess this is to work around the user not setting the port.
The text was updated successfully, but these errors were encountered: