Abstract: | In order to keep all IM clients for a user engaged in a conversation, outbound messages are carbon-copied to all interested resources. |
Authors: | Joe Hildebrand, Matthew Miller |
Copyright: | © 1999 - 2012 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Experimental |
Type: | Standards Track |
Version: | 0.7 |
Last Updated: | 2012-10-12 |
WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but 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. Requirements
3. Use Cases
3.1. Discovering Support
3.2. Enabling Carbons
3.3. Disabling Carbons
3.4. Error Cases
3.4.1. bad-request
3.4.2. feature-not-implemented
3.4.3. forbidden
3.4.4. not-allowed
3.5. Receiving Messages
3.6. Sending Messages
3.7. Avoiding Carbons for a single message
4. Business Rules
4.1. Interaction with Chat States
4.2. Handling of errors
4.3. Auto-responses
4.4. Mobile Considerations
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
7.1. Protocol Namespaces
7.2. Protocol Versioning
8. XML Schema
9. Acknowledgements
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
At the time of original writing of this XEP, many XMPP servers handle message stanzas sent to a user@host (or "bare") JID with no resource by delivering that message only to the resource with the highest priority for the target user. Some server implementations, however, have chosen to send these messages to all of the online resources for the target user. If the target user is online with multiple resources when the original message is sent, a conversation ensues on one of the user's devices; if the user subsequently switches devices, parts of the conversation may end up on the alternate device, causing the user to be confused, misled, or annoyed.
This XEP defines an approach for ensuring that all of my devices get both sides of all conversations in order to avoid user confusion. As a pleasant side-effect, information about the current state of a conversation is shared between all of a user's clients that implement this protocol.
If a server implements the Message Carbons capability, it MUST specify the "urn:xmpp:carbons:2" feature in its service discovery information features as specified in Service Discovery [1] or section 6.3 of Entity Capabilities [2]. Clients SHOULD NOT attempt to enable or disable Carbons if their server does not support this feature.
<iq xmlns='jabber:client' type='get' from='romeo@montague.net/orchard' id='info1'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq xmlns='jabber:client' type='get' to='romeo@montague.net/home' from='montague.net' id='info1'> <query xmlns='http://jabber.org/protocol/disco#info'> ... <feature var='urn:xmpp:carbons:2'/> ... </query> </iq>
Servers MUST NOT enable the Carbons protocol for a client by default, since unmodified clients might be confused by the new protocol. When a client wants to participate in the Carbons protocol, it sends an IQ set to enable the protocol.
<iq xmlns='jabber:client' type='set' id='enable1'> <enable xmlns='urn:xmpp:carbons:2'/> </iq>
Carbons will generally be enabled before the client sends the first undirected presence, to ensure that all inbound messages will be delivered according to the Carbon rules. The server will respond with an IQ result when Carbons are enabled:
<iq xmlns='jabber:client' type='result' id='enable1'/>
Some clients might want to disable Carbons. An example of this might be a mobile client that wants Carbons when the application is in the foreground, and disabled when it is in the background. To disable Carbons, clients send an IQ set:
<iq xmlns='jabber:client' type='set' id='disable1'> <disable xmlns='urn:xmpp:carbons:2'/> </iq>
The server will respond with an IQ result when Carbons are disabled:
<iq xmlns='jabber:client' type='result' id='disable1'/>
Enabling or disabling Carbons may fail in the several ways. If one of these errors is returned, the server MUST keep the previous state, where the initial state is Carbons disabled. For example, if the first enable returns an error, the server MUST NOT enable Carbons.
The sender has sent a stanza containing XML that does not conform to the appropriate schema or that cannot be processed. One example is an IQ stanza that includes an unrecognized value of the 'type' attribute. Another is changing to the state that is already in effect (enabling Carbons a second time).
<iq xmlns='jabber:client' id='enable1' type='error'> <error type='modify'> <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
The sender has sent an enable or disable request to a server that does not support the protocol. This SHOULD NOT happen in practice, because clients MUST check for server support before sending their request.
<iq xmlns='jabber:client' id='enable1' type='error'> <error type='cancel'> <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
The sender does is forbidden by policy from enabling or disabling Carbons.
<iq xmlns='jabber:client' id='enable1' type='error'> <error type='auth'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
The receiver does not allow any entity to turn on Carbons. This might occur in a multi-domain deployment, where administrators of one domain allow Carbons, but another does not.
<iq xmlns='jabber:client' id='enable1' type='error'> <error type='cancel'> <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
Messages of type chat that are addressed to the bare JID (localpart@domain) MUST be delivered according to RFC 6121 § 8.5.2, and MUST be copied by the receiving server to all of the resources for that user that are carbons-enabled. The process of making copies is known as "forking."
<message xmlns='jabber:client' from='juliet@example.com/balcony' to='romeo@example.net' type='chat'> <body>Wherefore art thou, Romeo?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
<message xmlns='jabber:client' from='juliet@example.com/balcony' to='romeo@example.net/garden' type='chat'> <body>Wherefore art thou, Romeo?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message> <message xmlns='jabber:client' from='juliet@example.com/balcony' to='romeo@example.net/home' type='chat'> <body>Wherefore art thou, Romeo?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
A carbons-enabled resource MUST NOT receive more than one copy of the message. A carbons-enabled resource that has a negative priority MUST still receive a copy of the message.
Messages of type "chat" that are addressed to a full JID (localpart@domain/resource) MUST be sent by the receiving server to the addressed resource. A copy of the message MUST also be sent to all of the Carbons-enabled resources for the receiving user, excluding the original destination (which is sent the original message according to the routing rules in RFC 6120 [3] and RFC 6120 [4]).
<message xmlns='jabber:client' from='juliet@example.com/balcony' to='romeo@example.net/garden' type='chat'> <body>What man art thou that, thus bescreen'd in night, so stumblest on my counsel?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
The copies sent to the Carbon-enabled resources are wrapped using Message Forwarding [5]. The wrapping message SHOULD maintain the same 'type' attribute value; the 'from' attribute MUST be the Carbon-enabled user's bare JID (e.g. "localpart@domain"); and the 'to' attribute SHOULD be the full JID of the resource receiving the copy. The content of the wrapping message MUST contain a <received xmlns='urn:xmpp:carbons:2'/> element and a <forwarded xmlns='urn:xmpp:forward:0'/> which contains the original message (properly namespaced as "jabber:client"):
<message xmlns='jabber:client' from='romeo@example.net' to='romeo@example.net/home' type='chat'> <received xmlns='urn:xmpp:carbons:2'> <forwarded xmlns='urn:xmpp:forward:0'> <message xmlns='jabber:client' from='juliet@example.com/balcony' to='romeo@example.net/garden' type='chat'> <body>What man art thou that, thus bescreen'd in night, so stumblest on my counsel?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message> </forwarded> </received> </message>
Carbons clients want to have copies of messages going in both directions for other resources associated with the same user. To that end, messages of type "chat" that are sent from any resource MUST be copied by the sending server to each of the resources that have enabled Carbons, but are not the sending resource.
<message xmlns='jabber:client' to='juliet@example.com/balcony' from='romeo@example.net/home' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
The copies sent to the Carbon-enabled resources are wrapped using Message Forwarding [6]. The wrapping message SHOULD maintain the same 'type' attribute value; the 'from' attribute MUST be the Carbon-enabled user's bare JID (e.g. "localpart@domain"); and the 'to' attribute SHOULD be the full JID of the resource receiving the copy. The content of the wrapping message MUST contain a <sent xmlns='urn:xmpp:carbons:2'/> element and a <forwarded xmlns='urn:xmpp:forward:0'/> which contains the original message (properly namespaced as "jabber:client"):
<message xmlns='jabber:client' from='romeo@example.net' to='romeo@example.net/garden' type='chat'> <sent xmlns='urn:xmpp:carbons:2'> <forwarded xmlns='urn:xmpp:forward:0'> <message xmlns='jabber:client' to='juliet@example.com/balcony' from='romeo@example.net/home' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message> </forwarded> </sent> </message>
Some clients might want to avoid carbons on a single message, while still keeping all of the other semantics of Carbon support. This might be useful for clients sending end-to-end encrypted messages, for example.
To avoid a message being Carbon-copied to its other resources, the sending client MUST add a private element in the "urn:xmpp:carbons:2" namespace. When the sending server receives the message, it MUST NOT make carbon copies to the other Carbons-enabled resources, and MUST remove the private element before forwarding the message to the intended recipient.
Note: use of the private mechanism will lead to partial conversations on other devices. This is the intended effect.
<message xmlns='jabber:client' to='juliet@example.com' from='romeo@example.net/home' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> <private xmlns='urn:xmpp:carbons:2'/> </message>
<message xmlns='jabber:client' to='juliet@example.com' from='romeo@example.net/home' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
Note that Chat State Notifications [7] recommends sending chat state notifications as chat type messages, which means that they will be subject to Carbon-copying. This is intentional.
Additionally, clients that implement Carbons MAY take special use of chat state notifications:
When a receiving server attempts to deliver a forked message, and that message bounces with an error for any reason, the receiving server MUST NOT forward that error back to the original sender. The receiving server SHOULD use the sent element in the bounce to determine that an error is from a forked message.
This rule is used to prevent some of the half-failure modes that have been an issue in other prototocols.
Clients that automatically respond to messages for any reason (e.g. when in the "dnd" presence show state) MUST take adequate care when enabling Carbons in order to prevent storms or loops. Carbon copies of messages MUST NOT be auto-replied to under any circumstances. Forked inbound messages SHOULD NOT be auto-replied to, unless the client has some way of ensuring no more than one auto-reply is sent from all of its user's resources.
Since mobile devices often must pay for network traffic based on usage, the enablement of Carbons for such devices should be undertaken advisedly. More complicated mechanisms for controlling the Carbon-copying or forking of individual conversations may need to be added to deal with mobile clients in the future.
The security model assumed by this document is that all of the resources for a single user are in the same trust boundary. Any forwarded copies received by a Carbon-enabled client MUST be from that user's bare JID; any copies that do not meet this requirement MUST be ignored.
Outbound chat messages that are encrypted end-to-end are not often useful to receive on other resources. As such, they should use the <private/> element specified above to avoid such copying, unless the encryption mechanism is able to accommodate this protocol.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [8].
This specification defines the following XML namespace:
Upon advancement of this specification from a status of Experimental to a status of Draft, the XMPP Registrar [9] shall add the foregoing namespace to the registry located at <http://xmpp.org/registrar/namespaces.html>, as described in Section 4 of XMPP Registrar Function [10].
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of XEP-0053.
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:xmpp:carbons:2' xmlns='urn:xmpp:carbons:2' elementFormDefault='qualified'> <xs:element name='disable' type='empty'/> <xs:element name='enable' type='empty'/> <xs:element name='private' type='empty'/> <xs:element name='received' type='forward-container'/> <xs:element name='sent' type='forward-container'/> <xs:simpleType name='empty' abstract='true'> <xs:restriction base='xs:string'> <xs:enumeration value=''/> </xs:restriction> </xs:simpleType> <xs:complexType name='foward-container' abstract='true'> <xs:choice> <xs:element name='forwarded' namespace='urn:xmpp:forward:0' minOccurs='1' maxOccurs='1'/> </xs:choice> </xs:complexType> </xs:schema>
The authors wish to thank Patrick Barry, Teh Chang, Jack Erwin, Craig Kaes, Kathleen McMurry, Tory Patnoe, Peter Saint-Andre, Ben Schumacher, and Kevin Smith for their feedback.
Series: XEP
Number: 0280
Publisher: XMPP Standards Foundation
Status:
Experimental
Type:
Standards Track
Version: 0.7
Last Updated: 2012-10-12
Approving Body: XMPP Council
Dependencies: XMPP Core, XMPP IM, XEP-0001, XEP-0030, XEP-0085, XEP-0296
Supersedes: XEP-0259
Superseded By: None
Short Name: carbons
Source Control:
HTML
This document in other formats:
XML
PDF
Email:
jhildebr@cisco.com
JabberID:
jhildebr@cisco.com
Email:
linuxwolf@outer-planes.net
JabberID:
linuxwolf@outer-planes.net
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 <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-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.
2. XEP-0115: Entity Capabilities <http://xmpp.org/extensions/xep-0115.html>.
3. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.
4. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.
5. XEP-0297: Message Forwarding <http://xmpp.org/extensions/xep-0297.html>.
6. XEP-0297: Message Forwarding <http://xmpp.org/extensions/xep-0297.html>.
7. XEP-0085: Chat State Notifications <http://xmpp.org/extensions/xep-0085.html>.
8. 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/>.
9. 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/>.
10. XEP-0053: XMPP Registrar Function <http://xmpp.org/extensions/xep-0053.html>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Moved carbons <received/> and <sent/> flags from being a sibling of <forwarded/> to being a parent of <forwarded/>, in compliance with XEP-0297.
(mm)Moved carbons flags from being a child of <forwarded/> to being a sibling of <forwarded/>; updating business rules regarding the <gone/> chat state.
(mm)Fixed more typos in examples; clarified that each resource only receives one copy of the message (forked or wrapped)
(mm)Fixed typos in examples.
(mm)Required the wrapping message to use the carbon user's bare JID; added to the security concerns about rejecting carbon copies not from the carbon user's bare JID.
(mm)Changed enabling and disabling to use separate elements rather than attributes; ensured all elements in the examples have their namespaces more explicitly defined; used message forwarding for carbon copies.
(mm)Initial published version.
(psa)Updated after further analysis of edge cases.
(jjh)First draft.
(jjh)END