Second connection for mosquitto broker failing

I am using mosquitto as a broker hosted on hivemq and I am able to make one connection but I am getting the following for second one
Connection failed due to: Exception during client actor initialization. - cause : Server closed connection without DISCONNECT. At 2022-03-29T11:31:47.150269482Z. Will reconnect after PT1M20S

any help would be appreciated.

Hello Pranshu,

welcome to our MQTT and HiveMQ community!

  1. Are you using the same clientId for both the 1st and 2nd client? In this case, when duplicate clientID is used, the broker will disconnect the earlier connected client.
  2. Are you using a mosquitto broker or HiveMQ broker? If it is a HiveMQ broker, is it a HiveMQ Cloud broker, or a self-hosted HiveMQ broker?
  3. Are you using a mosquitto MQTT Client or HiveMQ MQTT CLI? Please include the command line that you are using and the output that the command produces.

Thank you,
Dasha from HiveMQ Team

Hi

  1. I haven’t specified a client id( I have tried that but it is giving the same error), therefore my connections default to connection id which are both different.
  2. I am using HiveMQ cloud as a broker
  3. I am using mosquitto MQTT client

To give you an idea of what I am trying to do, I am following along on this example with hiveMQ as my broker ditto-examples/mqtt-quick-introduction at master · eclipse/ditto-examples · GitHub

My cluster however shows 2 connections made, is there a way of checking the connections in the cluster?

Hi @pranshuG ,

Checking connections in the cluster is available with HiveMQ Cloud Dedicated package.

You indicated:

  1. I haven’t specified a client id( I have tried that but it is giving the same error), therefore my connections default to connection id which are both different.

If you are sure that your MQTT Client generates a unique client id for you, then the reason for the DISCONNECT might be not a duplicate client id but some other reason.

To investigate your connection issue, first please make sure that you can connect to your broker using MQTT CLI. If MQTT CLI cannot connect to your broker, we can help you to analyse the error. For us to be able to help you to do that, please add the exact command and the error message here.

Kind regards,
Dasha from HiveMQ team