This specification defines recommended handling of XMPP message threads.
WARNING: This Informational document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the best practice or protocol profile described herein is encouraged in exploratory implementations, although production systems should not deploy implementations of this protocol until it advances to a status of Draft.
Publisher: XMPP Standards Foundation
Last Updated: 2006-12-20
Approving Body: XMPP Council
Dependencies: XMPP Core
Superseded By: None
Short Name: N/A
Wiki Page: <http://wiki.jabber.org/index.php/Best Practices for Message Threads (XEP-0201)>
This XMPP Extension Protocol is copyright 1999 - 2007 by the XMPP Standards Foundation (XSF) and is in full conformance with the XSF's Intellectual Property Rights Policy <http://www.xmpp.org/extensions/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).
The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) 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 following 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".
Note: This document describes a protocol or best practice that is intended for incorporation into the specification that will supersede RFC 3921  within the Internet Standards Process, i.e., rfc3921bis . This document is provided only for the purpose of open community discussion of the potential modification and will be obsoleted as soon as the relevant RFC is published.
Although message threads are re-used in XMPP extension protocols such as Chat State Notifications  and Chat Session Negotiation , the semantics of message threads have never been well specified (e.g., in RFC 3921). This document attempts to clearly specify the meaning and handling of message threads for implementation by XMPP clients and possible incorporation into the successor to RFC 3921.
Threads matter because they enable XMPP clients to:
Section 22.214.171.124 of RFC 3920 currently states the following regarding the semantics of the ThreadID:
The <thread/> element contains non-human-readable XML character data specifying an identifier that is used for tracking a conversation thread (sometimes referred to as an "instant messaging session") between two entities.
The description in RFC 3921 is deemed to be too limiting, since it ignores the potential use of the ThreadID when exchanging message stanzas of types other than 'chat'. Therefore we proposal the following description:
The primary use of the XMPP <thread/> element is to uniquely identify a conversation thread or "chat session" between two entities instantiated by <message/> stanzas of type 'chat'. However, the XMPP <thread/> element may also be used to uniquely identify an analogous thread between two entities instantiated by <message/> stanzas of type 'headline' or 'normal', or among multiple entities in the context of a multi-user chat room instantiated by <message/> stanzas of type 'groupchat'.
Section 126.96.36.199 of RFC 3920 currently states the following uniqueness requirement:
The value of the <thread/> element ... MUST be unique to that conversation thread within the stream and MUST be consistent throughout that conversation (a client that receives a message from the same full JID but with a different thread ID MUST assume that the message in question exists outside the context of the existing conversation thread).
The uniqueness requirement in RFC 3921 is not deemed strong enough since it is desirable that a ThreadID could be used to (for instance) restart a conversation at a later date. Therefore we propose the following uniqueness requirement:
For messages of type 'chat', 'headline', or 'normal', the value of the <thread/> element MUST be unique for the combination of the sender's bare JID and recipient's bare JID (i.e., the thread MUST NOT ever be repeated in communications between the sender and recipient). For messages of type 'groupchat', the value of the <thread/> element MUST be unique in the context of the multi-user chat room, as long as the room remains in existence.
In the context of <message/> stanzas of type 'chat' exchanged between two entities, the value of the <thread/> element shall be considered equivalent to a unique identifier for the chat session or conversation thread. If an entity receives such a message with a new or unknown ThreadID, it SHOULD treat the message as part of a session with unnegotiated parameters (i.e., as equivalent to the first message in a chat session that has been negotiated via XEP-0155 with no parameters specified). An entity SHOULD destroy the thread when it sends or receives a XEP-0155 "terminate" action and MAY destroy the thread when it goes offline, but SHOULD NOT destroy the thread if a human user merely closes a window in a client interface.
To ensure the uniqueness of ThreadIDs in the context of a multi-user chat room, the multi-use chat service MAY provide a way for room occupants to request a unique ThreadID; definition of such methods is out of scope for this specification.
There are no special handling requirements related to threads in the context of <message/> stanzas of type 'headline' or 'normal'.
Depending on the type of the message (i.e., the value of the 'type' attribute), the <thread/> should be included as follows:
In some contexts it may be desirable to enforce thread-like semantics when exchanging XMPP <iq/> stanzas. Because RFC 3920 disallows more than one direct child element of the <iq/> stanza, it is not possible to include the <thread/> element for tracking purposes. Therefore we define a "ThreadID" Stanza Headers and Internet Metadata  header with the same semantics as the <thread/> element, but with the syntax of a SHIM header:
<iq email@example.com/home' firstname.lastname@example.org' type='get' id='create1'> <command xmlns='http://jabber.org/protocol/commands' node='create' action='execute'> <headers xmlns='http://jabber.org/protocol/shim'> <header name='ThreadID'>e0ffe42b28561960c6b12b944a092794b9683a38</header> </headers> </command> </iq>
This document introduces no new security concerns or considerations above and beyond those specified in RFC 3920 and RFC 3921.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) .
The XMPP Registrar shall add "ThreadID" to its registry of SHIM headers. The submission is as follows:
<header> <name>ThreadID</name> <desc> This header has the same semantics as the thread child element of the XMPP message stanza but is for use in IQ stanzas. </desc> <doc>XEP-0201</doc> </header>
2. rfc3921bis: proposed revisions to Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://www.ietf.org/internet-drafts/draft-saintandre-rfc3921bis-00.txt>. (work in progress)
7. 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/>.