Closed jftaylorMn closed 1 year ago
The httpsclient.ino
provides the example of establishing a secure https connection. Whether using http or mqtt (which is TCP), the API and process of wrapping the TCP packet with secure layer is the same. Which is why we only show one example of using secure connection.
Anyway, I've updated the MqttClient.ino
example so that it can be configure for both non-secure (port 1883) and secure (port 8883) connection. Other than adding the root CA cert or changing the broker url, all you need to do is to comment-in or comment-out a newly added macro:
#define USING_SECURE_MQTT
Please take a look of the code and try it out. I tested it on test.mosquitto.org
broker on both port 1883 and 8883. Feel free to modify it for your broker configuration.
Sorry for the delay. I believe that your updated example code has resolved my issues. Appreciate the great support!!
[ x] I have read the Troubleshooting section of the ReadMe
What type of issues is this?
[ ] Request to support a new module
[ ] Bug or problem compiling the library [ ] Bug or issue with library functionality (ie, sending data over TCP/IP) [ x] Question or request for help
What are you working with?
Modem: Sim7080G dev board from And-one Main processor board: ESP32 SimpleNB version: Latest Code:
Scenario, steps to reproduce
Expected result
I really want to use HiveMQ Cloud as my MQTT broker, which requires a secure connection. An alternative would be to find another "free" broker in the cloud that does not require SSL. In my work, I have been in discussions with security experts about TLS and certificates, understand the concepts at a vert high level, but that is not sufficient to make your example for MQTT work for me.
Before attempting this with the SIm7080G modem, I have plowed through code to make a PUBSUBClient work over wifi. Sample ino is below
From that exercise, I know that the URL, Port, login and password are needed. in addition there is a root cert/pem file/string that is required to establish the MQTTs session.
From your readme, it appears that secure MQTT can happen with a SIM7080G modem, but the example I see in the repository doesn't seem to go to that level.
I suspect that this is not what you want to see in an issue, but there is scant detail elsewhere. I have looked at gitter and see a few comments related to the modem in the tinyGSM room. Mostly, there are questions without answers. When I dive into the AT commands related to MQTTs for this modem series, there is reference to multiple certificates and or/keys that are pulled from files - (presumably on LittleFS?). I can likely get that detail from HiveMQ if I know what to ask for. Since the wifi version only requires the server level pem, I think the GSM version should not need more than that using AT commands.
Any advice /example code would be greatly appreciated.
Actual result
Debug and AT command log