C.7 PubSub (Analog of Eventing)
C.7.3 Publishing a UCCD PubSub event
When a UCCD events a state variable, it shall update the corresponding PubSub leaf node by sending an <iq> stanza to its UCC PubSub service containing the publish element as described in the following template.
<iq
id="vendor defined value"
from="localpart@domainpart/resourcepart of UCCD conforming to section C.5.4"
to="PubSubName of UCS supporting UCA (see footnote in section C.6.6.3)" type="set">
<pubsub xmlns="http://jabber.org/protocol/pubsub"/>
<publish node="name of event leaf node as described above"> <item>
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0"> <e:property>
<variableName>new value</variableName> </e:property>
</e:propertyset> </item>
</publish> </pubsub> </iq>
<iq>, iq@id, iq@from, iq@to. Required. See equivalent in previous template for <iq> attributes.
@type
Required. Shall be implemented according to [XEP-0060]. Shall have a value of "set".
<pubsub>
Required. Shall be implemented according to [XEP-0060] for a pubsub element.
Shall have “http://jabber.org/protocol/pubsub” as the value for the xmlns
attribute (see schema in [XEP-0060]). Case sensitive.
Shall contain a publish element whose @node attribute is the name of the event
node.
Shall contain an item element containing an e:propertyset element as
described in section 4.3.2. Shall contain only <variableName> elements
corresponding to the state variable associated with the publish node name.
In the example below a UCCD (MediaServer) publishes and update to the ContentDirectory service SystemUpdateID state variable.
UCCD:[email protected]/urn:schemas-upnp- org:device:MediaServer:4:uuid:e70e9d0e-d9eb-4748-b163-636a323e7950 <iq id="WEnCONy2g1rJQ9SN0TWN" to="pubsub.mycloud.org" type="set"> <pubsub xmlns="http://jabber.org/protocol/pubsub"/> <publish node="urn:schemas-upnp-org:device: MediaServer:4:uuid:e70e9d0e-d9eb-4748-b163-636a323e7950 /ContentDirectory/SystemUpdateID"> <item> <e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0"> <e:property> <SystemUpdateID>2716658</SystemUpdateID> </e:property> </e:propertyset> </item> </publish> </pubsub> </iq>
Upon successful publication of the event, the UCCD shall receive an <iq> stanza identifying the specific unique ID of the published event as described in the following template.
<iq
id="vendor defined value"
to="localpart@domainpart/resourcepart of UCCD conforming to section C.5.4"
from="PubSubName of UCS supporting UCA (see footnote in section C.6.6.3)" type="set">
<pubsub xmlns="http://jabber.org/protocol/pubsub/"/>
<publish node="name of event leaf node as described above"> <item id="unique id of published leaf node event"/> </publish>
</pubsub> </iq>
@type
Required. Shall be implemented according to [RFC-6120]. Shall have a value of
"result".
<pubsub>
Required. Shall be implemented according to [XEP-0060] for a pubsub element.
Shall have “http://jabber.org/protocol/pubsub” as the value for the xmlns
attribute (see schema in [XEP-0060]). Case sensitive.
Shall contain a publish element whose @node attribute is the name of the event
node.
Should contain an item element whose @id attribute contains a unique value
identifying the specific publication.
If the publication fails then the subscribing UCCD should receive a <iq> stanza with the proper error code according to [XEP-0060].
Below is an example of the acknowledgement the UCCD receives from the event publication above. P->UCCD:[email protected]/urn:schemas-upnp- org:device:MediaServer:4:uuid:e70e9d0e-d9eb-4748-b163-636a323e7950 <iq id="WEnCONy2g1rJQ9SN0TWN" to="pubsub.mycloud.org" type="set"> <pubsub xmlns="http://jabber.org/protocol/pubsub"/> <publish node="urn:schemas-upnp-org:device: MediaServer:4:uuid:e70e9d0e-d9eb-4748-b163-636a323e7950 /ContentDirectory/SystemUpdateID"> <item id="ae890ac52d0df67ed7cfdf51b644e901"/> </publish> </pubsub> </iq>
Note that some additional considerations for special case events may be needed, such as a ContentDirectory service LastChange event; in these cases, a specific UCA Annex will be created to describe the support for the particular DCP.
Typically the PubSub event leaf node buffer has a depth of 1, therefore it is recommended that a PubSub retract message not be sent (to save on bandwidth) unless an event buffer specifically defined to be of length greater than 1 has been configured.
UCC-CPs subscribed to the event (leaf node) or any corresponding collection node will receive the event with item id and possible payload as described in the following template depending whether the UCCD configures with or without #deliver_payloads set and the itemnode is a leaf or collection type (see section 7 of [XEP-0060] for more detail). <message
id="unique id assigned by PubSubName of UCS supporting UCA "
to="localpart@domainpart/resourcepart of subscribed UCC-CP conforming to section C.5.4"
from="PubSubName of UCS supporting UCA (see footnote in section C.6.6.3)"> <event xmlns="http://jabber.org/protocol/pubsub#event"/>
<items node="name of event node as described above">
<item id="unique id assigned by PubSubName of UCS supporting UCA"> <e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
<e:property>
<variableName>new value</variableName> </e:property>
</e:propertyset> </item>
</items> </event> </message> <message>
@id
Required. Shall be implemented according to [RFC-6120]. Case sensitive. @from
Required. Shall be implemented according to [RFC-6120]. Shall have a value of the JID of the PubSuB service publishing the event. Case sensitive.
@to.
Required. Shall be implemented according to [RFC-6120]. Shall have a value of the
fullJID of the UCC-CP subscribed to the event. Case sensitive.
<event>
Required. Shall be implemented according to [XEP-0060] for a event element.
Shall have “http://jabber.org/protocol/pubsub#event” as the value for
the xmlns attribute (see schema in [XEP-0060]). Case sensitive. <items>
Required. Shall be implemented according to [XEP-0060] for an items
element. Case sensitive. @node
Required. Shall be implemented according to [XEP-0060] and contain a value corresponding to the event node.
<item>
Required. Shall be implemented according to [XEP-0060]. Case sensitive.
May contain an XML element whose value corresponds to the event
payload, that is, an e:propertyset element as described in section
4.3.2. @id
Required. Shall be implemented according to [XEP-0060]. Case sentitive.
In the example below, a UCC-CP subscribed to the event for the MediaServer in the previous example, receives notification of ContentDirectory service SystemUpdateID state variable change, and in this case, with delivery of the payload.
P->UCC-CP: [email protected]/urn:schemas-upnp-org:cloud-1-0: ControlPoint:1:ad93e8f5-634b-4123-80ca-225886a5c0e8 <message id="2g1rJQWEnCONy9SN0TWN" from="pubsub.mycloud.org" to="[email protected]/urn:schemas-upnp-org:cloud-1-0: ControlPoint:1:ad93e8f5-634b-4123-80ca-225886a5c0e8"> <event xmlns="http://jabber.org/protocol/pubsub#event"/> <items node="urn:schemas-upnp-org:device: MediaServer:4:uuid:e70e9d0e-d9eb-4748-b163-636a323e7950 /ContentDirectory/SystemUpdateId"> <item id="ae890ac52d0df67ed7cfdf51b644e901"> <e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0"> <e:property> <SystemUpdateID>2716658</SystemUpdateID> </e:property> </e:propertyset>
</item> </publish> </pubsub> </iq>