I’m trying to connect to my own cluster using an embedded system that uses a SIM808. This component works with AT commands.
To start the connection I’m using AT+CIPSTART=“TCP”,“xxxxxxx.s2.eu.hivemq.cloud”,8883
where the first address is found on “Manage cluster —> Host Name”.
With this command I can not estabilish the connection.
If I try to estabilish the connection with an other custom server everything goes ok.
AT+CIPSTART wants the server ip address and port. I think the problem is the server address. Where can I find it?
Connection to a HiveMQ Cloud cluster requires TLS enabled and username/password supplied with the connection command.
Does you device support TLS? Does you device require server certificate for the TLS connection? In case it does, you can generate the server certificate as described in the HiveMQ Cloud Frequently Asked Questions
Hi Florian and Daria
Thanks for the answer.
AT+CIPSTART is a platform command specific.
Basically, before establishing the connection with user name and password, I should establish a TCP connection.
To do so, I’m assuming that the host name is the “cluster” field and the port is 8883.
I’m not sure my platform accepts TLS connection. The problem could be this.
Some time ago, I managed to get a working connection without TLS with the port 1883.
So, my questions are:
Is there a way to use the ‘non TLS’ connection?
The host address to use is provided in the “cluster” field?
Not with HiveMQ Cloud broker - it only secure connection option, port 8883 and 8884 (WebSocket). We have a public broker (broker.hivemq.com) that is “non TLS” (ports 1883 and 8000). Attention: Testing and usage is for free but please do not use it for sensitive information because everybody is allowed to subscribe to every topic.
You have asked:
The host address to use is provided in the “cluster” field?
Correct, it is the URL field on the “Your clusters” page:
But what about the username, password, client_id to use?
The public broker does not use username&password authorization, any client can connect and access any topic (so do not include any sensible info into your messages).
And how can I check the publish and subscribe messages?
How to publish and subscribe depends on the client. For example, with MQTT CLI
Subscribe
mqtt sub -i 'iAmSubscriber' -t 'my/test/topic' -h broker.hivemq.com -p 1883
Publish
mqtt pub -i 'iAmPublisher' -t 'my/test/topic' -m "My message to you" -h broker.hivemq.com -p 1883
I hope this helps. If you have further questions please do not hesitate to ask.