Abstract: | This specification defines recommended handling of XMPP message threads. |
Authors: | Peter Saint-Andre, Ian Paterson, Kevin Smith |
Copyright: | © 1999 - 2010 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Experimental |
Type: | Informational |
Version: | 0.6 |
Last Updated: | 2010-05-21 |
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 are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
1. Introduction
2. Motivation
3. Definition
3.1. Semantics
3.2. Syntax
3.3. Uniqueness
4. Generation
4.1. Inclusion
4.2. New Threads
4.3. Child Threads
5. Handling
5.1. Chat Messages
5.2. Groupchat Messages
5.3. Headline Messages
5.4. Normal Messages
5.5. Messages That Have Been Archived
6. Security Considerations
7. IANA Considerations
8. XMPP Registrar Considerations
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
Although message threads are re-used in XMPP extension protocols such as Chat State Notifications [1], the semantics of message threads have never been well specified (e.g., in RFC 3921 [2]). This document attempts to clearly specify the meaning and handling of message threads for implementation by XMPP clients and for potential inclusion in rfc3921bis [3].
Threads matter because they enable XMPP clients to:
Section 2.1.2.3 of RFC 3921 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 value of the <thread/> element MUST be treated as opaque by entities; no semantic meaning may be derived from it, and only exact comparisons may be made against it.
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 propose 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'. It may also be used for <message/> stanzas not related to a conversation, such as a game session or an interaction between plugins. The <thread/> element is not used to identify individual messages, only conversations or messaging sessions.
Section 2.1.2.3 of RFC 3921 states the following regarding the syntax of the ThreadID:
A message stanza MUST NOT contain more than one <thread/> element. The <thread/> element MUST NOT possess any attributes.... The <thread/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of XML).
For the purpose of improved thread handling, we propose defining a 'parent' attribute that enables an application to identify the current thread as an offshoot or child of a previous thread. Therefore we suggest the following syntax definition:
The inclusion of the <thread/> element is OPTIONAL. Because the <thread/> element uniquely identifies the particular conversation thread to which a message belongs, a message stanza MUST NOT contain more than one <thread/> element.
The <thread/> element MAY possess a 'parent' attribute that identifies another thread of which the current thread is an offshoot or child; the value of the 'parent' attribute MUST conform to the syntax of the <thread/> element itself.
The <thread/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of ).
Section 2.1.2.3 of RFC 3921 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:
The value of the <thread/> element is not human-readable and MUST be treated as opaque by entities; no semantic meaning MAY be derived from it, and only exact comparisons may be made against it. The value of the <thread/> element MUST be a universally unique identifier (UUID) as described in RFC 4122 [5].
Depending on the type of the message (i.e., the value of the 'type' attribute), the <thread/> should be included as follows:
Message Type | Inclusion |
---|---|
chat | RECOMMENDED |
groupchat | RECOMMENDED |
headline | OPTIONAL |
normal | OPTIONAL |
Unless a <message/> stanza is written in direct reply to another <message/> stanza, if a ThreadID is included then its value SHOULD be newly generated when a human user initiates a chat conversation with another user (i.e., a <message/> stanza of type 'chat'), starts a new conversation in the context of a multi-user chat environment (i.e., a <message/> stanza of type 'groupchat'), or sends a normal message.
If the <message/> stanza is written in direct reply to another <message/> stanza, then the ThreadID SHOULD be the value from the the original <message/> stanza. (Determining what constitutes a <message/> stanza written in reply to another is a matter left to individual implementation, but it is envisaged that in most cases it would be the result of, e.g., the user clicking a 'reply' button when reading the contents of the previous stanza.)
In some situations, the conversation veers from the original topic. In this situation, it can be sensible to generate a new thread that is an offshoot or child of the original thread. The connection of the child thread to the parent thread SHOULD be indicated by including the original ThreadID as the value of the 'parent' attribute.
<message to='romeo@example.net/orchard' from='juliet@example.com/balcony' id='asiwe8289ljfdalk' type='chat' xml:lang='en'> <body>Art thou not Romeo, and a Montague?</body> <thread parent='7edac73ab41e45c4aafa7b2d7b749080'> e0ffe42b28561960c6b12b944a092794b9683a38 </thread> </message>
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. A client MAY destroy the thread when it goes offline, but SHOULD NOT destroy the thread if a human user merely disengages from the chat session (e.g., by closing a window in a client interface).
If an entity receives an XMPP presence stanza of type "unavailable" from the other entity during a chat session, it SHOULD NOT destroy the thread; instead, it SHOULD assume that the other entity will still be able to continue the session (perhaps the other entity was temporarily disconnected by a network error or is persisting the state of the session until it reconnects and receives "offline" messages).
If an entity receives a message of type "chat" without a thread ID, then it SHOULD create a new session with a new thread ID (and include that thread ID in all the messages it sends within the new session).
In the context of <message/> stanzas of type "groupchat" exchanged between multiple entities in a Multi-User Chat [6] room or similar environment, the value of the <thread/> element shall be considered equivalent to a unique identifier for a conversation thread in the multi-user environment.
When displaying a threaded groupchat conversation within a user interface, a client SHOULD provide a visual indication of the thread to which a message belongs. Methods for such indications include (non-exhaustively) the grouping together of all messages from the same thread, providing an index of threads, or formatting all messages within a thread in a cohesive manner, e.g. with uniform coloring.
There are no special handling requirements related to threads in the context of <message/> stanzas of type "headline".
There are no special handling requirements related to threads in the context of <message/> stanzas of type "normal".
When displaying historical conversations within a user interface, a client SHOULD provide a visual indication of the thread to which a message belongs. Methods for such indications include (non-exhaustively) the grouping together of all messages from the same thread, providing an index of threads, or formatting all messages within a thread in a cohesive manner, e.g. with uniform coloring.
An application that generates the UUID used as the ThreadID MUST ensure that the UUID does not reveal identifying information about the entity (e.g., the MAC address of the device on which the XMPP application is running).
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [7].
This document requires no interaction with the XMPP Registrar [8].
Series: XEP
Number: 0201
Publisher: XMPP Standards Foundation
Status:
Experimental
Type:
Informational
Version: 0.6
Last Updated: 2010-05-21
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: N/A
Source Control:
HTML
RSS
This document in other formats:
XML
PDF
Email:
stpeter@jabber.org
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
Email:
ian.paterson@clientside.co.uk
JabberID:
ian@zoofy.com
Email:
kevin@kismith.co.uk
JabberID:
kevdadrum@jabber.ex.ac.uk
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 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 <http://xmpp.org/about/discuss.shtml> 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-0085: Chat State Notifications <http://xmpp.org/extensions/xep-0085.html>.
2. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc3921>.
3. rfc3921bis: proposed revisions to Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/draft-ietf-xmpp-3921bis>. (work in progress)
4. XEP-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.
5. RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace <http://tools.ietf.org/html/rfc4122>.
6. XEP-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.
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/>.
8. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Simplified several handling rules; removed ThreadID SHIM header for IQ stanzas; removed implementation note about In-Reply-To SHIM header; removed references to XEP-0155; corrected some errors; harmonized text with rfc3921bis in coordination with editor's review.
(psa)Defined parent attribute and provided recommendations regarding creation of new threads and child threads.
(psa)Specified handling of thread IDs on groupchat messages.
(psa)Described handling of unavailable presence and chat messages without thread IDs; minor changes.
(ip)Equalized treatment of different message types (chat and groupchat not preferred over normal); required the use of UUIDs; specified use of In-Reply-To header; added Kevin Smith as co-author.
(psa/ks)Initial version.
(psa)END