...
Repeat the process for the Thing2 pico.
Listing Subscriptions
Info | ||
---|---|---|
| ||
The examples below are for an older version of subscriptions. This will be updated soon. |
If we were now to query the Mischief Pico to see its subscriptions, using a URL like
Code Block |
---|
http://localhost:8080/sky/cloud/cj0dea39q0001khpqy4su0ru3/io.picolabs.subscription/getSubscriptionsestablished |
we would see that it participates in two subscriptions:
Code Block |
---|
{[ "mischief:thing1": { "eciRx_role": "cj0deky300006khpqn7ucdvhjcontroller", "nameTx_role": "mischief:thing1thing", "typewellKnown_Tx": "subscriptionGTrQY4dzrkr7n39Lezp9mf", "attributesRx": {"5aEtRXKB2uM6WXWbPtgySs" }, "subscription_name": "thing1", { "nameRx_spacerole": "mischiefcontroller", "relationshipTx_role": "controller<->thingthing", "mywellKnown_roleTx": "controllerGTrQY4dzrkr7n39Lezp9mf", "subscriber_roleRx": "thingSLebvDm7d9MTQzBNqPn8nR", "subscriber_eci": "cj0dea81g0003khpqy7j9knqz", "status": "outbound", "attributes": "" } }, "mischief:thing2": { "eci": "cj0devoqc0008khpqenjg11xc", "name": "mischief:thing2", "type": "subscription", "attributes": { "subscription_name": "thing2", "name_space": "mischief", "relationship": "controller<->thing", "my_role": "controller", "subscriber_role": "thing", "subscriber_eci": "cj0deacyn0005khpq8q0qk080", "status": "outbound", "attributes": "" } } } |
Code Block |
{ "mischief:thing1": { "eci": "cj0deky3l0007khpqdmo4037y", "name": "mischief:thing1", "type": "subscription", "attributes": { "subscription_name": "thing1", "name_space": "mischief", "relationship": "thing<->controller", "my_role": "thing", } ] |
Similarly, the Thing1 Pico participates in just one subscription. Doing the same sky/cloud
query to its ECI will show something like this:
Code Block |
---|
[ { "subscriberRx_role": "controllerthing", "outboundTx_ecirole": "cj0deky300006khpqn7ucdvhjcontroller", "statusTx": "inboundSLebvDm7d9MTQzBNqPn8nR", "attributesRx": "Qn2oh1pe6aXbkyLVcr9L9b" } } } |
...
] |
Accepting Subscriptions
There is one step remaining in the subscription process. Just because one pico offers a subscription to another pico doesn't mean that target pico is forced to accept it. This is manifest by the "status" of the subscriptions. For the originating pico, the status is "outbound" (short for outbound, pending), and for the other pico, the status is "inbound" (i.e. inbound, pending).
...