Connecting with MQTT without WebSockets
Hello everyone,
I'm getting started with Solace, and I am trying to write a simple Python program that publishes a message to a broker topic using the MQTT protocol.
I have issues establishing a connection with the broker service without using Web Sockets. My program does not seem to get any connack message.
I was wondering if any broker configuration step is needed to be able to connect over TLS.
Thanks
Tagged:
Comments
Hi! You will need to configure a server certificate on solace broker to activate SSL/TLS ports. Documentation section for the procedure is here: https://docs.solace.com/Configuring-and-Managing/Managing-Server-Certs.htm
If network security allows it, try connecting first to non-ssl port to confirm the problem is with TLS configuration.
@Aleksei Thank you for the info!
I'll configure the server certificate and see if it works. Thank you!
Hey @ludobar! I wrote a bolg post a while back on how to use Python MQTT to establish a connection with a Solace Broker , you will find it interesting you can check it out here https://dev.to/solacedevs/how-i-used-covid-tracking-data-to-build-and-learn-a-python-event-driven-application-1l44. In a nutshell, I used the
paho.mqtt.client
as followsYou can also check this thread https://solace.community/discussion/comment/973#Comment_969
Also, are you aware of the Solace Python API? It is still in beta early access, let me know if you're interested to be invited to a group and try it out!
@Tamimi thank you for the code snippet and for the post. It really helps me speeding up at coding!
Right now I'm focusing on MQTT, but I might be interested in exploring Solace APIs in the future. I will keep it in mind!
Hey @ludobar ! I just came across this again and wanted to follow up, do you still have any issues with TLS connection with the broker?
Hey @Tamimi ! At the end I figured everything out. I shared my program on the community in this post https://solace.community/discussion/461/python-program-connecting-over-tls-ssl-to-pubsub-cloud#latest, in the hope of helping anyone struggling with it