...
The following rule would be selected upon seeing the cloudos:subscriptionRequestAdded
event with appropriate values for the event attributes:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule process_subscriptionRequestAdded {
select when cloudos subscriptionRequestAdded
namespace re/MyFriends/"
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
...
} |
Upon see the subscription, the CloudOS service in the target cloud raises the cloudos:subscriptionRequestPending
to signal the receipt of a pending subscription request:
Domain | cloudos |
---|
Type | subscriptionRequestPending |
Attributes | eventChannel, namespace, relationship, channelName, subAttrs |
Note: The subAttrs attribute is encoded, you will want to decode() it prior to use.
The following rule would be selected upon seeing the cloudos:subscriptionRequestAdded
event with appropriate values for the event attributes:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule process_subscriptionRequestPending {
select when cloudos subscriptionRequestPending
namespace re/MyFriends/"
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
pre {
subAttrs = event:attr("subAttrs").decode();
}
...
} |
Subscription Event Flow
Image RemovedImage Added
- The
cloudos:subscribe
event is raised by the originating personal cloud. - CloudOS will create a new channel and raise the
cloudos:subscriptionRequestAdded
event within the originating personal cloud. The main purpose for raising this event is to provide the application developer the opportunity to capture the newly created channel, backChannel. - CloudOS then raises an event to the target personal cloud over the targentChannel (typically the doorbell ECI) requesting the subscription.
- CloudOS in the target personal cloud will raise the
cloudos:subscriptionRequestPending
giving rulesets the opportunity to respond with either an approval or rejection (see below).
Subscription Approval or Rejection
...
The following shows a rule that is selected when the cloudos:subscriptionAdded event
is raised:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule process_subscriptionAdded {
select when cloudos subscriptionAdded
namespace re/MyFriends/
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
pre {
approveAttrs = event:attr("approveAttrs").decode();
}
...
} |
Subscription Approval Event Flow
Image RemovedImage Added
- The
cloudos:subscriptionRequestApproved
event is raised into the target personal cloud after creating a new channel. - CloudOS raises the
cloudos:subscriptionAdded
event within the target personal cloud. - CloudOS raises a event over the eventChannel to the originating personal cloud to indicate that the subscription request has been approved.
- Within the originating personal cloud CloudOS raises the
cloudos:subscriptionAdded
event.
Rejection
To reject the subscription request a ruleset in the the target cloud raises the cloudos:subscriptionRequestRejected
event to signal the CloudOS service that the subscription is rejected:
Domain | cloudos |
---|
Type | subscriptionRequestRejected |
Attributes | eventChannel |
For example, the following postlude would raise the cloudos:subscriptionRequestRejected
event:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired {
raise cloudos event subscriptionRequestRejected
with eventChannel = "3f15b820-af7f-012f-4c6e-00163ebcaaaa"
and _api = "sky";
} |
When the subscription request is rejected the CloudOS service will raise the cloudos:subscriptionRejected
event within the target cloud (i.e. the cloud rejecting the subscription):
Domain | cloudos |
---|
Type | subscriptionRejected |
Attributes | eventChannel, namespace, relationship, channelName |
The following rule is selected when the cloudos:subscriptionRejected
event is seen:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule receive_subscriptionRejected {
select when cloudos subscriptionRejected
namespace re/MyFriends/
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
...
} |
In addition, the CloudOS service raises the cloudos:subscriptionRejected
event in the originating cloud:
Domain | cloudos |
---|
Type | subscriptionRejected |
Attributes | backChannel, namespace, relationship, channelName |
The only difference is that the attribute backChannel is contains the value of the ECI to the target cloud.
The following rule is selected when the cloudos:subscriptionRejected
event is raised:
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule receive_subscriptionRejected {
select when cloudos subscriptionRejected
namespace re/MyFriends/
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
...
} |
Subscription Rejection Event Flow
Image RemovedImage Added
- The
cloudos:subscriptionRequestRejected
event is raised into the target personal cloud. - CloudOS raises the
cloudos:subscriptionRejected
event within the target personal cloud. - CloudOS raises an event over the eventChannel to the originating personal cloud to indicate that the subscription request was rejected.
- Within the originating personal cloud CloudOS raises the
cloudos:subscriptionRejected
event.
...
Domain | cloudos |
---|
Type | unsubscribe |
Attributes | backChannel |
...
The targetChannel
attribute uniquely identifies the channel to be unsubscribed. The backChannel
is one of the results provided by the subscriptionList()
function.
...
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
fired {
raise cloudos event unsubscribe
with backChanneltargetChannel = "3f15b820-7aff-012f-4c6e-00163ebcfddfd"
and _api = "sky";
} |
...
Code Block |
---|
theme | Confluence |
---|
language | javascript |
---|
|
rule receive_subscriptionRemoved {
select when cloudos subscriptionRemoved
namespace re/MyFriends/
channelName re/Coworkers Bob+Ted/
relationship re/friend-friend/
pre {
approveAttrs = event:attr("approveAttrs");
}
...
} |
Unsubscribe Event Flow
Image RemovedImage Added
- The
cloudos:unsubscribe
event is raised into the originating personal cloud. Note that it is also possible to raised the cloudos:unsubscribe
event in the target personal cloud as well. "Originating" and "target" are relative to where the cloudos:unsubscribe
event is raised. - CloudOS raises the
cloudos:subscriptionRemoved
event within the originating personal cloud. - CloudOS raises an event over the eventChannel to the target personal cloud to indicate that the subscription has been removed.
- CloudOS raises the
cloudos:subscriptionRemoved
event within the target personal cloud.
...