When a device is connected to IoT Platform, the device is in the Online state. When a device is disconnected from IoT Platform, the device is in the Offline state.

Connect a device to IoT Platform

Develop a device and connect the device to IoT Platform.

Note The following section describes how to directly connect a device to IoT Platform. For more information about how to connect sub-devices to IoT Platform, see Connect sub-devices to IoT Platform.
  1. Develop the device.

    IoT Platform provides Link SDK for multiple programming languages. These SDKs encapsulate protocols for communication between devices and IoT Platform. For more information, see What is Link SDK?.

    When you develop a device, configure the identity information of the device. The identity information is used to authenticate the device when you connect the device to IoT Platform.

    IoT Platform supports the following methods to authenticate directly connected devices:

    • Unique-certificate-per-device authentication: Burn a unique device certificate to each device in advance. The device certificate includes the ProductKey, DeviceName, and DeviceSecret.
    • Unique-certificate-per-product authentication: Burn a product certificate to all devices of the product. The product certificate includes the ProductKey and ProductSecret. You must also enable dynamic registration on the Product Details page of the IoT Platform console. When a device initiates a connection request, IoT Platform verifies the product certificate. If the device passes the authentication, IoT Platform issues a DeviceSecret to the device.
  2. Install Link SDK to the device.
  3. Power on the device, connect the device to the network, and then connect the device to IoT Platform.

Disconnect a device from IoT Platform

After a device is disconnected from IoT Platform, the device is in the Offline state in IoT Platform. Device disconnection is categorized into the following types:

  • Active disconnection: A device ends the connection with IoT Platform.
  • Forcible disconnection: IoT Platform ends the connection with a device.

    For example, a device is forced to disconnect from IoT Platform if another device uses the same device certificate to access IoT Platform. A forcible disconnection also occurs if you delete or disable the device in IoT Platform.

MQTT keep-alive mechanism

The heartbeat interval of an MQTT connection ranges from 30 to 1,200 seconds. If a heartbeat interval is out of the specified value range, the server rejects the connection request. We recommend that you set the heartbeat interval to a value that is greater than 300 seconds.

A timer starts when IoT Platform sends a CONNACK message as a response to a CONNECT message. When IoT Platform receives a PUBLISH, SUBSCRIBE, PING, or PUBACK message, the timer is reset. If no message is received within 1.5 times the specified heartbeat interval, the server terminates the connection.