Connecting to cluster

Hi,

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?

Thanks,
Marco.

Hi Marco,

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

Thanks,
Dasha from HiveMQ team

Hi Marco,

Can you please provide some more details about what kind of client library/setup you are trying to use?

I am not aware what AT+CIPSTART means.

I think the problem is the server address. Where can I find it?

HiveMQ Cloud free does not private an endpoint that is reachable via IP.

Kind regards,
Florian

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:

  1. Is there a way to use the ‘non TLS’ connection?
  2. The host address to use is provided in the “cluster” field?

Thanks,
Marco

Hi Marco,

You have asked:

  1. Is there a way to use the ‘non TLS’ connection?

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:

  1. The host address to use is provided in the “cluster” field?

Correct, it is the URL field on the “Your clusters” page:

or the hostname field on the “Cluster details” page:
image

For testing different authentication and

1 Like

Hi Daria,

thanks for answering me.
Instead, in order to use the ‘public broker’ the host name is : “http://broker.hivemq.com/” and port:1883.

But what about the username, password, client_id to use? And how can I check the publish and subscribe messages?
Thanks,
Marco.

Hi Marco,

You have asked:

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.

Kind regards,
Dasha from HiveMQ team

Hi Daria, sorry for delay.

I’m understanding the things you said me but I have an other question (about TLs).

How can I find the TLS certificate of my cluster created?

Hi Marco,

You can create the Server Certificate file using the command openssl s_client as described in the community’s Frequently Asked Questions, like this:

openssl s_client -connect 4ad85b7fade04d07911be2ac1da2f5e4.s2.eu.hivemq.cloud:8883 -showcerts < /dev/null 2> /dev/null | sed -n '/BEGIN/,/END/p' > server.pem

Let me know if that helps!
Kind regards,

Dasha from HiveMQ Team