MQTT Disconnects


I have created a MQTT connection for a Thing in a thing scope.
But the connection is keep on disconnecting every 2 seconds please let me know why and How to resolve this?

Hi kmharishku,

Thank you for using Kii Cloud.

Could you please provide some detailed informations?

  • How do you get the mqtt endpoing: by Kii SDK or REST API?
  • How do you establish the MQTT connection?

Hi yongping,

Below are the steps which i am doing get mqtt endpoint.

  1. Logging in as thing and getting the access token using RestEndPoint
    2.Using that access token I am requesting for mqttt installation through Kii RestApi.
  2. With the installtion ID i got from above step i am getting the mqtt endpoint by hitting

I did some analysis on this issue and i found that.

The device we are trying to control through kii is connected to Kii through MQTT for sending and receiving the commands…
And i am also connecting to the Thing in the Kii to get the notifications from Kii via MQTT.
I assume since there is one existing connections to the kii with same clientId and topicId for the thing so kii is not letting me to connect with same mqtt endpoint.
If i am correct please suggest me a solution for this.

Thanks for your suggestions.

As you said, kii cloud only allows one mqtt connection with same clientID and topicID.
Please make sure there is not other app establish the same mqtt connection.

Here is a guide for establish mqtt connection via JS SDK. please confirm:

Please let me know if there is anything confuse.

Oh. I just realized that you wanna send command to device.
You need to onboard the thing first.

Please confirm onboarding for detail. Since you are using REST API, you can get the document of rest api of onboarding from there

Calling onboarding API, server will response mqtt endpoint (same as you did in step 2: With the installtion ID ). Then you can use this endpoint to establish the mqtt connection.