Connection fail in HiveMQ cloud

Hi,
I created a new account for HiveMQ cloud and a cluster with credentials but can not connect via mqtt-cli in windows. The message I got is
“Server closed connection without DISCONNECT.”
why? any suggestion

Hello

Welcome to the HiveMQ Community forum. Glad to see you’re taking interest in HiveMQ and MQTT.

Looks like you missed adding -s while connecting to the broker. Please add it and retry.

Adding command for your reference:

$ con -h <cluster-url> -p <port-number> -s -u <mqtt-credentials-username> -pw <mqtt-credentials-password>

Adding an -s flag to the connect command opens a secure connection to the MQTT Broker with the default SSL configuration.

For more details please check our Documentation.

Kind regards,
Sheetal

Thanks a lot for your comment , but I’have really done exactly what you say, like documentation. Could it be because the payment section was not completed?
I have not done it yet and enter credit card information?

Hello, have you find a solution ? I’ve got exactly the same problem. Windows 10 mqtt-cli client : “Server closed connection without DISCONNECT.” I followed the exact quick start…

Hi edouareg .
Not yet, I use windows 7

Server closed connection without DISCONNECT
Did anyone solve this? I am getting same thing from multiple clients.
I installed mqtt-cli (on Windows 10); the “con” command does not connect. I’ve spent several hours trying various things: no luck.
I switched to mqtt-cli because python-paho was also disconnecting (rc=1), so this was part of debugging that problem… only to find they both fail.

Server closed connection without DISCONNECT.

I’m on Windows 11 and have the exact same issue. I have triple checked my address, port, and credentials and then some. All from the mqtt> prompt in the shell. The cluster is Connected with the green dot next to it.

I confirm the cluster itself is working. When I use the HiveMQ WebSocket Client browser tool the pub/sub works. I copy/paste the connection strings from my mqtt-cli connection string… so those are also correct.
Odd though, my wireshark trace is shorter than I would have expected… with only 1 SSL message.

mqtt-cli problem SOLVED.
Upgraded mqtt-cli worked.
I got the link for the earlier version from the HiveMQ web site… can’t tell you how/where just now. But when I went to github directly, and found the latest… that version works.

python-paho problem? I’ll work on that next.

My paho-python code is now also working. The API changed between mqtt 3 and 5, though the documentation for 5 has been sparse (to be kind). Specifically, there are now 5 arguments to the on_connect where there used to be 4.

Mike, what ae the 5 arguments? Even though I am using the cmd line it may have bearing on my issue. I use the format below from the HiveMQ docs.

con -h -p -s -u -pw

What would be the 5th? Thanks.

I also went to github and got the latest version of HiveMQ CLI. When I signed up I got ver 1 and the latest is 4.7.1. Now I am able to connect using the 4 attributes above and proceeded to sub and pub. Thanks for the idea Mike!

( Realize that above the -s and -u are together after the port number.)

This video was handy to but I did not have to use mqtt before the commands.

Cheers for the utube pointer. HiveMQ videos are prolific and immensely useful.
My problem with the extra parameter was in the Python PAHO library, rather than MQTT CLI (which worked instantly once I installed the latest version).

MQTT 5 introduced user-properties, and PAHO-for-Python made it mandatory in the connect callback function… probably others as well.
The fix I made was:
V3
def on_connect(client, userdata, flags, rc):
V5
def on_connect(client, userdata, flags, rc, properties: None):

I’m still looking for V5 PAHO API documentation… I’m sure I just haven’t looked in the right places.

Some of the information is very elusive. I’m taking baby steps over here. We’re trying to keep this as simple as possible.