After your devices and server are connected to IoT Platform, the devices and server can communicate by using IoT Platform.
Devices send data to IoT Platform
After you connect devices to IoT Platform, the devices can communicate with IoT Platform. The devices can use either of the following ways to send data to IoT Platform:
- Use custom topics to send custom-format data.
- On the IoT Platform console, set Allowed Operations of a custom topic to Publish. Product topics are automatically mapped to the devices under the product.
You can create custom topics by using either of the following methods:
- Use the IoT Platform console. For more information, see Custom topics.
- Use IoT Platform SDK. You can call the CreateProductTopic API operation to create a custom topic.
- Configure devices to send messages to custom topics when you develop the devices.
You must configure custom topics and message formats for sending messages on devices. For information about how to use Link SDK that is provided by IoT Platform, see The device sends a message to the server.
- On the IoT Platform console, set Allowed Operations of a custom topic to Publish. Product topics are automatically mapped to the devices under the product.
- Use Thing Specification Language (TSL)-specific topics to send data.
For more information about TSL features, see What is a TSL model?.
Devices can submit properties and events.
Procedure
- In the IoT Platform console, define TSL features based on your business requirements. For more information, see Add a TSL feature.
- When you develop your devices, configure the devices to submit properties and events
based on the defined TSL features.
For more information about the standard data formats for properties and events that are submitted by devices, see Submit device properties and Submit device events.
Note IoT Platform provides predefined TSL-specific topics. You can directly use these topics.For information about how to use the Link SDK that is provided by IoT Platform, see Submit properties and events by using Link SDK.
IoT Platform forwards data to enterprise servers
You can configure IoT Platform to use either of the following methods to forward data to your server. The data that can be forwarded includes messages submitted by devices, changes of device status, changes of device lifecycles, historical TSL data, firmware update status, information of new sub-devices that are discovered by gateways, and changes of device topologies. Messages are forwarded based on topics. For more information about the data formats of topics, see Data formats.

- Server-side subscription: You can use the server-side subscription feature provided
by IoT Platform to subscribe to messages of one or more types. IoT Platform can forward
messages of specified types from all devices under the product to your server based
on your subscription settings. You can use either of the following methods to configure
a server-side subscription:
- Use the AMQP SDK to receive device data that is forwarded by IoT Platform. For more information, see AMQP server-side subscription.
- Use Message Service (MNS) SDK to receive device data that is forwarded by IoT Platform to MNS queues. For more information, see MNS server-side subscription.
- Data forwarding: You can use the data forwarding feature of the rules engine to forward
specified device data to MNS topics or RocketMQ queues based on data forwarding rules.
You can receive messages on your server by using MNS SDK or RocketMQ SDK.
- Create a rule to forward device data to an MNS topic or RocketMQ queue. For more information, see Configure a data forwarding rule.
- Use MNS SDK to receive messages. For more information, see Manage MNS topics.
For information about the differences between data forwarding and server-side subscription, see Compare data forwarding solutions.
Perform remote control on devices
You can use IoT Platform SDK on your server to achieve remote control on devices. To perform remote control on devices, you must call API operations to send commands from IoT Platform to the devices. The server can use either of the following ways to send commands:

- Use custom topics to control remote devices.
- Asynchronous control: Call the Pub operation to send custom-format data to a custom topic whose Allowed Operations parameter
is set to Subscribe. Devices subscribe to this topic to receive messages.
Note You cannot call the Pub operation to send TSL-related commands.
For more information about how to use custom topics to control remote devices, see The server sends a message to the device.
- Synchronous control: Call the RRpc operation to send messages to specified devices and synchronously retrieves the responses.
For more information about synchronous MQTT communication, see What is RRPC?.
For more information about how to call the RRpc operation for synchronous communication, see Remotely control Raspberry Pi servers.
- Batch control: Call the PubBroadcast operation to broadcast messages to all online devices.
For more information about how to achieve batch control, see Broadcast messages.
- Asynchronous control: Call the Pub operation to send custom-format data to a custom topic whose Allowed Operations parameter
is set to Subscribe. Devices subscribe to this topic to receive messages.
- Use TSL-specific topics.
You can use TSL-specific API operations to send property setting or service calling commands from IoT Platform to devices.
- Control a single device.
- Call the SetDeviceProperty operation to send a property setting command to a single device.
After IoT Platform sends the command, the device receives and runs the command in an asynchronous manner. To check whether the device properties are updated, you must view the properties that are later submitted by the device.
- Call the InvokeThingService operation to send a service calling command to a single device.
The Invoke Method parameter determines whether a service is called in a synchronous or asynchronous manner. This parameter is specified when you customize the service.
If the Invoke Method parameter is set to Synchronous, the response is synchronously returned after the InvokeThingService operation is called.
If the Invoke Method parameter is set to Asynchronous, the response is asynchronously returned after the InvokeThingService operation is called. You can use the rules engine to retrieve the response. You must set the data source of the SQL query for the rule to TSL Data Reporting and set the specific topic to
thing/downlink/reply/message
. For more information about how to configure data forwarding rules, see Configure a data forwarding rule.
- Call the SetDeviceProperty operation to send a property setting command to a single device.
- Control multiple devices.
- Call the SetDevicesProperty operation to send a property setting command to multiple devices.
- Call the InvokeThingsService operation to send a service calling command to multiple devices.
For more information about how to use TSL-specific topics to control remote devices, see Achieve TSL-based communication.
- Control a single device.
Achieve communication between devices
You can connect devices at two ends to IoT Platform and use IoT Platform to process connection and communication requests between the devices. The following topics describe the two methods that can be used to achieve communication between devices: