Note: this page is inspired by (and often copied verbatim from) the original fourth lesson, Lesson: Pico to Pico Subscriptions.
Learning Objectives
After completing this lesson, you will be able to do the following:
- Understand pico-to-pico relationships and subscriptions
- Use the developer tools to manage pico subscriptions
- Link two or more picos with a subscription programmatically and have them interact.
Prerequisites
You should have already completed the following lessons:
Pico Engine Quickstart lesson. (Be able to register and install rulesets)
Pico Programming Lesson: Events and Queries Lesson. (Be able to create channels and understand how events are raised on channels)
- Pico Programming State Lesson: Pico State. (Be able to store and retrieve state using entity variables, both simple and complex)
Pico Programming Lesson: Pico-Based Systems Lesson. (Be able to manage the pico lifecycle using UI and programmatically)
- Read Wrangler Subscriptions description.
Subscriptions
Subscriptions play an important role in building systems of picos. In Pico Programming Lesson: Pico-Based Systems Lesson, you created child picos. If the parent-child relationship were the only one that existed, we could create hierarchies of picos, but not peer-to-peer systems of picos. Subscriptions allow us to establish relationships between any two picos.
A subscription represents a relationship between two picos. It has a name and two channels, one from each pico participating in the subscription to the other. Each side in the subscription can be given a role to further identify the purpose of the subscription.
Subscriptions Using the UI
To be written...
Managing Subscriptions Programmatically
Wrangler provides functions, actions, and rules for managing subscriptions from within your KRL code.
...