Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: change RID for the subscriptions ruleset

...

Info
titleEngine Compatibility

Very soon, the ability to manage subscriptions will be built-in to every pico. Right now, you will need to install the ruleset with RID "Subscriptionsio.picolabs.subscription" into the three picos which will participate in subscriptions. This can be done in the Rulesets tab of each pico, by clicking on the "install ruleset" button beside the dropdown when it shows "Subscriptionsio.picolabs.subscription".

The "Subscriptionsio.picolabs.subscription" ruleset is automatically registered in the pico engine during start-up, because it exists (in a file named "io.picolabs.subscriptions.krl") in the folder name "krl". However, it is not automatically installed in any pico. Soon, it will be.

Since most of the heavy lifting is done by the Subscriptions ruleset io.picolabs.subscription ruleset, it is easy to initiate, approve, and use subscriptions inside of your own rulesets.

...

Suppose that we wanted the Mischief pico to respond to a mischief/hat_lifted event and send the same event to all of the thing picos that it controls. Assuming that you have arranged to use Subscriptions as a module in the meta block, as in

Code Block
  use module io.picolabs.subscription alias Subscriptions

a rule like this one would accomplish this:

...

The raised event triggers a rule in the Subscriptionsio.picolabs.subscription ruleset. This rule takes care of deleting both sides of the subscription.

...

Code Block
http://localhost:8080/sky/cloud/cj0dea39q0001khpqy4su0ru3/Subscriptionsio.picolabs.subscription/getSubscriptions

we would see that it participates in two subscriptions:

...

In fact, after the pending subscriptions were created, the Subscriptions rule io.picolabs.subscription rule for wrangler/subscription raises the wrangler event "inbound_pending_subscription_added" passing along all of the attributes. It is up to your pico to react by either accepting or rejecting. This cookbook example shows how to write a rule that auto-approves subscriptions.

...