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 - 2015 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Proposed |
Type: | Standards Track |
Version: | 0.9 |
Last Updated: | 2013-10-17 |
NOTICE: This document is currently within Last Call or under consideration by the XMPP Council for advancement to the next stage in the XSF standards process. The Last Call ends on 2015-08-28. Please send your feedback to the standards@xmpp.org discussion list.
1. Introduction
2. Requirements
3. Discovering Support
4. Enabling Carbons
4.1. Recommended Error Conditions
5. Disabling Carbons
5.1. Recommended Error Conditions
6. Receiving Messages to the Bare JID
7. Receiving Messages to the Full JID
8. Sending Messages
9. Avoiding Carbons for a single message
10. Business Rules
10.1. Handling Multiple Enable/Disalble Requests
10.2. Interaction with Chat States
10.3. Handling of Errors
10.4. Auto-responses
10.5. Mobile Considerations
11. Security Considerations
12. IANA Considerations
13. XMPP Registrar Considerations
13.1. Protocol Namespaces
13.2. Protocol Versioning
14. XML Schema
15. 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.
An entity advertises support for this protocol by including the "urn:xmpp:carbons:2" feature in its service discovery information features as specified in Service Discovery (XEP-0030) [1] or section 6.3 of Entity Capabilities (XEP-0115) [2].
<iq xmlns='jabber:client' from='romeo@montague.example/garden' id='info1' to='montague.example' type='get'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq xmlns='jabber:client' from='montague.example' id='info1' to='romeo@montague.example/garden' type='result'> <query xmlns='http://jabber.org/protocol/disco#info'> ... <feature var='urn:xmpp:carbons:2'/> ... </query> </iq>
When a client wants to participate in the Carbons protocol, it enables the protocol by sending an IQ-set containing a child element <enable/> qualified by the namespace "urn:xmpp:carbons:2":
<iq xmlns='jabber:client' from='romeo@montague.example/garden' id='enable1' type='set'> <enable xmlns='urn:xmpp:carbons:2'/> </iq>
The server will respond with an IQ-result when Carbons are enabled:
<iq xmlns='jabber:client' from='romeo@montague.example' id='enable1' to='romeo@montague.example/garden' type='result'/>
If the server cannot enable Carbons for this client, it sends an IQ-error to the client, with an appropriate error condition (e.g., <forbidden/> if local policy forbids the client from enabling):
<iq xmlns='jabber:client' from='romeo@montague.example' id='enable1' to='romeo@montague.example/garden' type='error'> <error type='auth'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
There are various reasons why a server might not be able to enable Carbons for a client. The RECOMMENDED error conditions to return for some reasons are:
See the section Handling Multiple Enable/Disable Requests for considerations when a client attempts to enable Carbons multiple times.
Some clients might want to disable Carbons. To disable Carbons, the client sends an IQ-set containing a child element <disable/> qualified by the namespace "urn:xmpp:carbons:2":
<iq xmlns='jabber:client' from='romeo@montague.example/garden' id='disable1' type='set'> <disable xmlns='urn:xmpp:carbons:2'/> </iq>
The server will respond with an IQ-result when Carbons are disabled:
<iq xmlns='jabber:client' from='romeo@montague.example' id='disable1' to='romeo@montague.example/garden' type='result'/>
If the server cannot disable Carbons for this client, it sends an IQ-error to the client, with an appropriate error condition (e.g., <not-allowed/> if trying to disable another client's Carbons):
<iq xmlns='jabber:client' from='romeo@montague.example' id='disable1' to='juliet@capulet.example/balcony' type='error'> <error type='cancel'> <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>
There are various reasons why a server might not be able to disable Carbons for a client. The RECOMMENDED error conditions to return for some reasons are:
See the section Handling Multiple Enable/Disable Requests for considerations when a client attempts to disable Carbons multiple times.
When the server receives a <message/> of type "chat" addressed to a bare JID (localpart@domainpart), it delivers a copy to each Carbons-enabled resource for the bare JID – in addition to delivering according to RFC 6121 § 8.5.2. This process is sometimes called "forking".
<message xmlns='jabber:client' from='juliet@capulet.example/balcony' to='romeo@montague.example' type='chat'> <body>Wherefore art thou, Romeo?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
<message xmlns='jabber:client' from='juliet@capulet.example/balcony' to='romeo@montague.example/garden' type='chat'> <body>Wherefore art thou, Romeo?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message> <message xmlns='jabber:client' from='juliet@capulet.example/balcony' to='romeo@montague.example/home' type='chat'> <body>Wherefore art thou, Romeo?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
The receiving server MUST deliver a copy to every Carbons-enabled resource, even if that resource normally would not receive <message/> stanzas addressed to the bare JID (e.g., resources which have broadcast <presence/> with a negative priority). A Carbons-enabled resource MUST NOT receive more than one copy of the <message/>.
When the server receives a <message/> of type "chat" addressed to a full JID (localpart@domainpart/resourcepart), it delivers the <message/> according to RFC 6121 § 8.5.3, and delivers a forwarded copy to each Carbons-enabled resource for the matching bare JID recipient.
Each forwarded copy is wrapped using Stanza Forwarding (XEP-0297) [3]. The wrapping message SHOULD maintain the same 'type' attribute value; the 'from' attribute MUST be the Carbons-enabled user's bare JID (e.g., "localpart@domainpart"); and the 'to' attribute MUST be the full JID of the resource receiving the copy. The content of the wrapping message MUST contain a <received/> element qualified by the namespace "urn:xmpp:carbons:2", which itself contains a <forwarded/> element qualified by the namespace "urn:xmpp:forward:0" that contains the original <message/>.
<message xmlns='jabber:client' from='juliet@capulet.example/balcony' to='romeo@montague.example/garden' type='chat'> <body>What man art thou that, thus bescreen'd in night, so stumblest on my counsel?</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
<message xmlns='jabber:client' from='romeo@montague.example' to='romeo@montague.example/home' type='chat'> <received xmlns='urn:xmpp:carbons:2'> <forwarded xmlns='urn:xmpp:forward:0'> <message xmlns='jabber:client' from='juliet@capulet.example/balcony' to='romeo@montague.example/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>
The receiving server MUST NOT send a forwarded copy to the full JID the original <message/> stanza was addressed to, as that recipient receives the original <message/> stanza.
When a client sends a <message/> of type "chat", its sending server delivers the <message/> according to RFC 6120 and RFC 6121, and delivers a forwarded copy to each Carbons-enabled resource for the matching bare JID sender.
Each forwarded copy is wrapped using Stanza Forwarding (XEP-0297) [4]. The wrapping message SHOULD maintain the same 'type' attribute value; the 'from' attribute MUST be the Carbons-enabled user's bare JID (e.g., "localpart@domainpart"); 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/> element qualified by the namespace "urn:xmpp:carbons:2", which itself contains a <forwarded/> qualified by the namespace "urn:xmpp:forward:0" that contains the original <message/> stanza.
<message xmlns='jabber:client' from='romeo@montague.example/home' to='juliet@capulet.example/balcony' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message>
<message xmlns='jabber:client' from='romeo@montague.example' to='romeo@montague.example/garden' type='chat'> <sent xmlns='urn:xmpp:carbons:2'> <forwarded xmlns='urn:xmpp:forward:0'> <message xmlns='jabber:client' to='juliet@capulet.example/balcony' from='romeo@montague.example/home' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> </message> </forwarded> </sent> </message>
The sending server SHOULD NOT send a forwarded copy to the sending full JID if it is a Carbons-enabled resource.
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 exclude a <message/> from being forwarded to other Carbons-enabled resources, the sending client add a <private/> element qualified by the namespace "urn:xmpp:carbons:2" as a child content element to the <message/> stanza.
Note: use of the private mechanism might lead to partial conversations on other devices. This is the intended effect.
<message xmlns='jabber:client' from='romeo@montague.example/home' to='juliet@capulet.example/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' from='romeo@montague.example/home' to='juliet@capulet.example/home' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>0e3141cd80894871a68e6fe6b1ec56fa</thread> <private xmlns='urn:xmpp:carbons:2'/> </message>
The sending server MUST NOT deliver forwarded <message/>s to the other Carbons-enabled resources of the sender. The receiving server MUST NOT deliver forwarded <message/>s to the other Carbons-enabled resource of the recipient, and SHOULD remove the <private/> element before delivering to the recipient.
Note: if the private <message/> stanza is addressed to a bare JID, the receiving server still delivers it according to RFC 6121. This might result in a copy being delivered to each resource for the recipient, which effectively negates the behavior of the <private/> element for recipients.
If a client is permitted to enable Carbons during its login session, the server MUST allow the client enable and disable the protocol multiple times within a session. The server SHOULD NOT treat multiple enable requests (without an intermediate disable request) as an error; it SHOULD simply return an IQ-result (if the protocol is already enabled) or an IQ-error (if the client is not permitted to enable Carbons) for any subsequent requests after the first. Similarly, the server SHOULD NOT treat multiple disable requests (without an intermediate enable request) as an error; it SHOULD return an IQ-result (if the protocols is already disabled) or an IQ-error (if the client's request failed previously) for any subsequent requests after the first.
Note that Chat State Notifications (XEP-0085) [5] recommends sending chat state notifications as chat type messages, which means that they will be subject to Carbon-copying. This is intentional.
Additionally, there are other considerations for clients that implement Carbons and XEP-0085:
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 MUST 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.
Enabling this protocol on mobile devices needs to be undertaken with care. This protocol can result in additional bandwidth and power usage, possibly decreasing battery lifetime and increasing monetary costs. Additional mechanisms for controlling the Carbon-copying or forking of individual conversations might 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 Carbons-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) [6].
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 [7] 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 (XEP-0053) [8].
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:
Proposed
Type:
Standards Track
Version: 0.9
Last Updated: 2013-10-17
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. XEP-0297: Stanza Forwarding <http://xmpp.org/extensions/xep-0297.html>.
4. XEP-0297: Stanza Forwarding <http://xmpp.org/extensions/xep-0297.html>.
5. XEP-0085: Chat State Notifications <http://xmpp.org/extensions/xep-0085.html>.
6. 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/>.
7. 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/>.
8. 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/
Reorganized to emphasize uses; removed discussion on error conditions required of "non-supporting" entities; relaxed multiple enables/disables to effectively no-ops; removed requirement for <private/> to be stripped from messages processed by the sending server; reworded "Interaction with Chat States" to be consistent with RFC 2119 language; updated mobile considerations to include battery life; changed all examples to use ".example" for the domainpart.
(mm)Updated use case text to match schema and examples.
(mm)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