...
The CloudOS Subscription Event Protocol provides an event based model for managing subscriptions between Personal Clouds. The current implementation of the protocol will create a symmetric relationship between both Personal Clouds. In order to used use the Subscription Event Protocol the CloudOS ruleset must be installed in the Personal Cloud for both the originating originator and target.
Subscribe
The system:subscribe
event is used to create a Personal Channel channel between two Personal Clouds.
- domain:
cloudos
- type:
subscribe
- attributes:
channelName
namespace
relationship
targetChannel
- The
channelName
attribute is a label associated with the subscription that should convey meaning to developer. ThechannelName
is only used as a component in the creation of the event channel tokenidentifier. If nochannelName
is specified the value of "orphan" will be used. - The
namespace
attribute is provided as a means for the developer to group subscriptions within a single, or group, or applications. Thenamespace
is used to filter the list of subscriptions returned by thesubscriptionList()
function. If not nonamespace
is specified the value of "shared" will be used. - The
relationship
attribute is provided as a means for allows the developer to characterize the relationship between the originating originator and target Personal Cloudclouds. Therelationship
attribute should be specified as a pair of values separated by a dash (e.g.parent-child
,peer-peer
,master-slave
). The first value of the relationship attribute will be stored with the originating Personal Cloud subscription, the second value will be stored with the target Personal Cloud subscription. Therelationship
attribute values are used to filter the list of subscriptions returned by thesubscriptionList()
function. If not no relationship is specified the value of "peer-peer" will be used. - The
targetChannel
attribute is the Personal Channel token event channel identifier for the target Personal Cloud cloud to which the subscription is to be made.
The sending Personal Cloud will have the following event raised to signal that the subscription request has been received:
- domain: cloudos
- type: subscriptionRequestAdded
- attributes: targetChannel, backChannel, namespace, relationship, channelName
app wishing to create the subscription signals the CloudOS to do so by raising the
system:subscribe
event. This is most often done in a rule postlude as shown in the following example:Code Block | ||||
---|---|---|---|---|
| ||||
fired {
raise cloudos event subscribe
with channelName = "Coworkers Bob+Ted"
and namespace = "MyFriends"
and relationship = "friend-friend"
and targetChannel = "3f15b820-af7f-012f-4c6e-00163ebczzzz"
and _api = "sky";
} |
The Personal Cloud Upon receiving the subscription request will have , the target cloud raises the following event raised to signal the receipt of a pending subscription requestthe originating cloud:
- domain:
cloudos
- type:
-
subscriptionRequestAdded
- attributes:
-
targetChannel
,backChannel
,namespace
,relationship
,
-
channelName
Code Block | ||||
---|---|---|---|---|
| ||||
rule receive_subscriptionRequestAdded select when cloudos subscriptionRequestAdded namespace re/MyFriends/" channelName re/Coworkers Bob+Ted/ relationship re/friend-friend/ |
The Personal Cloud receiving the subscription request will have the following event raised to signal the receipt of a pending subscription request:
- domain: cloudos
- type: subscriptionRequestPending
- attributes: eventChannel, namespace, relationship, channelName
Subscription Approval or Rejection
...
- domain: cloudos
- type: CloudOS_subscriptionRemoved
- attributes: eventChannel, backChannel, namespace, relationship, channelName
Code Block | ||||
---|---|---|---|---|
| ||||
rule receive_CloudOS_subscriptionRemoved select when cloudos CloudOS_subscriptionRemoved namespace re/MyFriends/ channelName re/Coworkers Bob+Ted/ relationship re/friend-friend/ |
...