%ents; ]>
Service Discovery Extensions This document specifies best practices for including extended information in Service Discovery results. &LEGALNOTICE; 0128 Active Informational Standards XMPP Core XEP-0004 XEP-0030 XEP-0068 N/A &stpeter; 1.0.1 2019-07-30 gdk Remove now-incorrect informational statement about the likelihood of multiple forms in a single disco#info reply. 1.0 2004-10-20 psa Per a vote of the Jabber Council, advanced status to Active; also added implementation notes. 0.2 2004-03-15 psa Clarified syntax and corrected several errors; added IM server example. 0.1 2004-03-05 psa Initial version.

Developers periodically wonder why &xep0030; does not include more bits of information. For example, why does the <identity/> element not include a 'description' attribute, and can we add one now? The answer is: well, it just doesn't, and at this point it's too late to make further changes (since XEP-0030 is Final). So the best approach is to specify a well-defined extension mechanism.

Let us consider an example. A &xep0045; room might want to include additional information in its service discovery results, such as the full room description, the current discussion topic (room subject), the number of occupants in the room, and the JID of the room owner.

Adding one new attribute to the service discovery schema (even if that were an option) would not solve the problem, since a MUC service might want to provide certain bits of information, whereas a &xep0060; service might want to provide other bits.

A better solution would be to include extended information qualified by a namespace that provides a way to flexibly define structured data formats. Thankfully, we already possess such a protocol: &xep0004;. In addition, we possess a way to define common fields used in data forms: &xep0068;. Using these building blocks, we can define some best practices for extending service discovery results.

If an entity desires to provide extended information about itself in an IQ results stanza within the context of the Service Discovery protocol, it SHOULD do so by including each bit of information as the XML character data of the <value/> child of a distinct <field/> element, with the entire set of fields contained within an <x/> element of type "result" qualified by the 'jabber:x:data' namespace; this <x/> element SHOULD be a child of the <query/> element qualified by the 'http://jabber.org/protocol/disco#info' namespace. Thus the IQ result SHOULD be of the following form:

... [var-value] ... ]]>

Note: A <field/> element MAY contain more than one <value/> child if appropriate.

If the data fields are to be used in the context of a protocol approved by the XMPP Standards Foundation, they SHOULD be described in the relevant XMPP Extension Protocol specification and registered in accordance with the rules defined in XEP-0068, resulting in the inclusion of a <field/> element whose 'var' attribute has a value of "FORM_TYPE" and whose 'type' attribute has a value of "hidden".

An entity MUST NOT supply extended information about associated children communicated via the 'http://jabber.org/protocol/disco#items' namespace, since a core principle of Service Discovery is that an entity must define its own identity only and must not define the identity of any children associated with the entity.

The following is an example of including a disco extension in the IQ result sent by a standard instant messaging server.

http://jabber.org/network/serverinfo 5222 5223 http://shakespeare.lit/jabber ipv4 ipv6 http://shakespeare.lit/support.php ]]>

The following is an example of including a disco extension in the IQ result sent by a Multi-User Chat room.

http://jabber.org/protocol/muc#roominfo The place for all good witches! Spells 3 en ]]>

In general, the XMPP Standards Foundation may choose to define at most one FORM_TYPE for each service discovery identity (category+type) registered with the XMPP Registrar. In addition, particular applications may define application-specific FORM_TYPEs as well, and one entity may have multiple service discovery identities (e.g., an XMPP server might also function as a publish-subscribe service). Therefore, it is possible (and allowed) for a single service discovery result to contain multiple service discovery extension elements (potentially up to two elements for each identity).

Applications SHOULD ensure that information disclosed in a disco extension is appropriate for discovery by any entity on the network.

This document requires no interaction with &IANA;.

This document requires no interaction with the ®ISTRAR;; however, specifications following the best practices defined herein may register FORM_TYPEs and field values with the XMPP Registrar.