Applications communicate with each other through publish/subscribe (PubSub), an asynchronous messaging service that decouples services that produces messages from the services processing them.
An application can publish serializable data on a topic which is then sent to all subscribers. Applications can also subscribe to a topic to receive all the publications on this topic.
topic: A named resource which is used when messages are published.
Device topic: A topic that enables intra-communication on the device. These topics will be prefixed with:
Cloud topic: A topic that enables inter-communication between devices and external systems. These topics will be prefixed with:
subscription: an identifier of a stream of messages from a specific topic. Note that is possible to do concurrent reads on one subscription. When doing so, the concurrent reads will receive different batches of the same data set, making it easier to make ingestion concurrent.
message: the combination of the data from the publisher and an identification of the sender.
See some examples of PubSub communication between apps in the Tutorials section.
Go to the PubSub page and click on Create Subscription. The topic
cloud:topic-name is the one defined in the Publisher Toit program.
You can provide a name of the subscription, in order to give a description of the topic or in which scenarios it is used.
Once you have created a subscription, two graphs visualize the number of unacknowledged messages for that subscription, as well as the age of the oldest unacknowledged message for a specific time interval.
Delete a subscription with the bin icon.
Use the CLI commands to acknowledge messages for a subscription.
PubSub messages can be sent from the cloud to one specific device only by providing the
device-id in the command:
It is also possible to create server-side PubSub subscriptions across multiple topics as long as they share a common prefix.
For example, create a subscription for the topics