One of the key mechanisms in Publish-Subscribe (XEP-0060) [1] is its subscription functionality, which allows users to be notified of changes in node content. This specification extends this mechanism by allowing subscriptions to an entire hierarchy using "parent" relationships as defined in XEP-XXXX: Pubsub Node Relationships. Subscribers will receive notifications when items are published or retracted, nodes are added or removed from a branch, or nodes and their descendants are deleted. Additionally, the specification introduces an option for subscribing to metadata updates, enabling users to be notified of changes in node relationships, access models, or any other kind of metadata.
The design goals of this XEP are:
This specification uses subscription options as defined in Publish-Subscribe (XEP-0060) [1]. Those options can be configured by following §6.3 Configure Subscription Options.
The type of subscription is defined by the 'var' attribute with a value of "{urn:xmpp:pubsub-ext-sub:0}type". This option MUST have the type "list-multi", and it MUST default to only the "items" value. The possible values for this field are:
The subscription depth is used when a client wants to subscribe to a parent node and all its descendants (up to requested depth). The "parent" relationship is explained in XEP-XXXX Pubsub Node Relationships.
The 'var' attribute for the subscription depth field MUST be "{urn:xmpp:pubsub-ext-sub:0}depth", and it MUST have a type of "text-single".
The value MUST be castable to a signed integer, and it MUST default to "0". This value indicates how many levels of descendants this subscription must apply to:
However, an implementation MAY limit the maximum depth for performance reasons; in such cases, it MUST be advertised through disco as explained in Discovering Support. When the subscription depth has a value different from "0", subscriptions must dynamically adapt to nodes added or removed within the arborescence: if a node gains a new "parent" relationship to any subscribed node, it will automatically become part of the subscription; conversely, if such a relationship is modified or the node is deleted, it will no longer be included in the subscription.
In this example, Romeo is subscribing to the 'some-node-name' node and requesting to receive notifications for items, metadata updates, and linked items within the entire node hierarchy (unlimited depth).
If the service allows the subscription, it MUST inform the requesting entity that it is now subscribed.
This section describes the notifications that are sent for each subscription type: items, metadata, and linked items.
When a user subscribes to items, notifications are sent for items published or retracted within the subscribed node and its descendants (if applicable, and if the entity is allowed to see the item). Each notification contains an <items> element within an <event> element, which includes one or more <item> elements. This is the same notification as explained in XEP-0060 §7.1.2.1 Notification With Payload.
When a user subscribes to metadata updates, notifications are sent for changes in node metadata. Each notification contains a <configuration> element within an <event> element, which includes the updated metadata. The notification SHOULD include only the updated data.
When a node is removed from a branch of a parent relationship tree-like structure by changing the 'parent' field, and if it is part of a subscription with suitable depth, the last metadata notification is sent. This notifies the XMPP client that the node has been removed by checking the modified 'parent' field.
In the following example, the 'parent' field is changed to remove the node from the branch it was on. Note that the field is present, but set to an empty value.
When a user subscribes to linked items, notifications are sent for items published or retracted within nodes that have a "link" relationship with the subscribed node. Each notification contains an <items> element within an <event> element, which includes one or more <item> elements, as explained in Publish-Subscribe (XEP-0060) [1]. The subscription is effective even if the linked relationship was established after the initial subscription.
When subscribing with a specified depth on a node, an implicit subscription is created for all descendants up to the indicated number of levels (or without limit if the depth is a negative number). The depth implicit subscription depends on the subscription type: if "linked items" are requested, linked items MUST be included; otherwise, they MUST NOT be included (i.e., only descendants with no 'link' field set will trigger notifications).
Implicit subscriptions MUST respect the access model of the node where the item has been published and all its parent nodes as explained in XEP-XXXX: Pubsub Node Relationships §4.4 Parent Relationship Rules.
A pubsub service MAY filter out metadata fields from notification, e.g., if they are not relevant in this use case, or if they would trigger too many notifications. This is an implementation-dependent decision.
If a pubsub service supports the protocol specified in this XEP, it MUST advertise it by including the "urn:xmpp:pubsub-ext-sub:0" discovery feature in response to a Service Discovery (XEP-0030) [2] information request.
If a pubsub service has a limitation in the maximum supported subscription depth, it MUST advertise that fact in the node metadata (as specified in XEP-0060 §5.4 Discover Node Metadata) with a field which MUST have a 'var' attribute set to "{urn:xmpp:pubsub-ext-sub:0}max-depth", a 'type' attribute set to "text-single", and a value which MUST be castable to an integer. If no such field is defined, that means the pubsub service has no depth limit.
When doing an implicit subscription, pubsub service MUST be sure to respect the access model of implicitely subscribed node and all its parents as explained in XEP-XXXX Pubsub Node Relationships 4.4 Parent Relationship Rules. If an entity is not allowed by any of the access model, the pubsub service MUST NOT send a notification.
Similarly, a metadata update notification MUST NOT be send if the subscribed entity would not otherwise be allowed to see the metadata.
This document does not require interaction with the Internet Assigned Numbers Authority (IANA) [3].
TODO
Thanks to NLNet foundation/NGI Zero Core for funding the work on this specification.
This document in other formats: XML PDF
This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).
Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.
## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.
This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).
The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0060: Publish-Subscribe <https://xmpp.org/extensions/xep-0060.html>.
2. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.
3. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/
Promoted to Experimental
First draft.
@report{poisson2024pubsub-ext-sub, title = {Pubsub Extended Subscriptions}, author = {Poisson, Jérôme}, type = {XEP}, number = {0497}, version = {0.1.0}, institution = {XMPP Standards Foundation}, url = {https://xmpp.org/extensions/xep-0497.html}, date = {2024-10-15/2024-11-20}, }
END