MQTT-Based Connection


Devices can connect to EnOS directly or via a gateway using the MQTT protocol. The MQTT protocol is a lightweight, open-source IoT protocol based on TCP/IP. EnOS’s MQTT protocol supports the following features:

  • Topic-based data subscription and publishing, where communication resources are isolated by topics to prevent unauthorized data access by devices.

  • Reverse Remote Procedure Call (abbr. RRPC), enabling real-time control, status queries, and synchronous interactions between the cloud and devices.

MQTT Ports


Domain

Port

Protocol

Supports Certificate-Based Two-Way Authentication

mqtt-{env}

11883

TCP

No

mqtt-{env}

18883

TCP + TLS

Yes

Where, “{env}” is the domain name of the EnOS environment. For example, if your logged-in EnOS domain is “app-portal-eu2.envisioniot.com”, the domain name will be “mqtt-eu2.envisioniot.com”.

MQTT Protocol Versions


The MQTT version that EnOS supports is:

  • MQTT v3.1.1 on port 11883 if you use the secret-based one-way authentication.

  • MQTT v3.1.1 over SSL/TLS on port 18883 if you use the certificate-based two-way authentication.

Connection Procedure


The typical procedure to enable a device to connect to EnOS Cloud via the MQTT protocol is:

  1. Register the device to obtain its ProductKey, DeviceKey, and DeviceSecret for authentication.

  2. Develop the device-end program to enable devices to connect to EnOS Cloud and transmit data. EnOS provides the following SDKs for you to develop your device-end programs.

    For a comparison of the functions available in different device SDKs, see Using EnOS Device SDKs for Device Development.

    If the SDK provided by EnOS does not meet your needs, you can also develop your own MQTT access protocol based on the MQTT parameter specifications defined by EnOS. For more information, refer to Device Connection Based on MQTT Protocol.

  3. Activate the device using the authentication keys obtained in step 1 and start to transmit data.