Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section explains how devices can use the MQTT bridge to communicate with ClearBlade IoT Core. For information about HTTP and MQTT information, see Protocols.Refer to the API documentation for full details about each method described in this section.

To publish over the MQTT bridge:

  1. Install an MQTT client on your device.

  2. Download an MQTT server certificate onto your device.

  3. Configure the MQTT client to authenticate the device to ClearBlade IoT Core.

  4. Initiate a TLS handshake over the appropriate MQTT regional URL or an external proxy run in your instance group.

  5. Publish telemetry events or set the device state.

MQTT server

ClearBlade IoT Core supports the MQTT protocol by running a managed broker that listens to port 8883. Port 8883 is the standard TCP port reserved with IANA for secure MQTT connections. Connections to this port must use TLS transport, supported by open-source clients like Eclipse Paho.

...

  • QoS 0, delivered at most once

  • QoS 1, delivered at least once

  • QoS 2, delivered exactly once

ClearBlade IoT Core does not support QoS 2. Publishing QoS 2 messages closes the connection, and subscribing to a predefined topic with QoS 2 downgrades the QoS level to QoS 1.

QoS 0 and 1 function as follows in ClearBlade IoT Core:

...

Messages published to a subfolder are forwarded to the Cloud Pub/Sub topic with the same name. The corresponding registry must be configured with the Cloud Pub/Sub topic; otherwise, messages are forwarded to the default Cloud Pub/Sub topic.

...

Separate from the keep-alive interval, ClearBlade IoT Core’s idle time limit is 20 minutes. Based on this, a client connection will automatically be terminated if the client doesn't send any messages for 20 minutes, even if the keep-alive interval is longer. If a keep-alive value isn't supplied, the default 20-minute idle timeout still takes effect.

Error

...

codes

The ClearBlade MQTT broker honors these MQTT 3.1.1 error codes:

Value

Return Code Responsecode response

Description

0

0x00 Connection Accepted

Connection accepted

1

0x01 Connection Refused, unacceptable protocol version

The server does not support the MQTT protocol level requested by the client

2

0x02 Connection Refused, identifier rejected

The client identifier is correct (UTF-8) but unallowed by the server. A duplicate clientid can cause this

3

0x03 Connection Refused, Server unavailable

The network connection has been made, but the MQTT service is unavailable

4

0x04 Connection Refused, bad user name or password

The data in the user name or password is malformed

5

0x05

Unused by IoT Core

13

0x13

All other events for connect, disconnect, publish, and subscribe

...