The most common use of the Device Messaging API is for devices to send data and for applications to retrieve the data, which is one-way messaging. Each device that sends messages has a unique name that is known to the application, and the application uses those names to retrieve the messages. For example, monitoring devices for tanks of liquid might send a message every hour with the current temperature and the current liquid level in the tank, and an application could retrieve that data and display a chart, or send an alert if a temperature gets too high or a level gets too low.
If you need to do two-way messaging so that your application can send messages to your devices, you must create the sending-and-retrieving arrangement in reverse, but there are certain caveats to think about:
For example, a simple scenario with two tank monitoring devices and an application might send and receive messages using these names:
|Tank or application||Sends as||Listens for|
|Tank A||Tank A||AllTanks-send
|Tank B||Tank B||AllTanks-send
|Tank Monitor App||AllTanks-Send