Abstract: | This document defines methods for distributing Multi-User Chat (MUC) rooms across multiple chat services. |
Author: | Peter Saint-Andre |
Copyright: | © 1999 - 2010 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Experimental |
Type: | Standards Track |
Version: | 0.1 |
Last Updated: | 2010-06-11 |
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
1.1. Motivation
1.2. Requirements
1.3. Approach
2. Terminology
2.1. General Terms
2.2. Entities
3. Use Cases
3.1. Creating a Room
3.2. Replicating a Room
3.3. Joining a Room
3.4. Sending a Message
3.5. sync
4. Determining Support
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
8. Acknowledgements
9. XML Schema
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
This document is one of several proposals for distributing XMPP chat rooms across multiple chat services. It is expected that the various approaches will be refined and harmonized before a final protocol is developed.
Multi-User Chat [1] defines a full-featured technology for multi-user text conferencing in XMPP. By design, XEP-0045 assumes that a conference room is hosted at a single service, which can be accessed from any point on the network. However, this assumption introduces a single point of failure for the conference room, since if occupants at a using domain lose connectivity to the hosting domain then they also lose connectivity to the room. In some deployment scenarios (and even on the open Internet) this behavior is suboptimal. Therefore, this document attempts to define a technology for distributing MUC rooms across multiple services.
This specification addresses the following requirements:
The basic approach to distribution of MUC rooms is as follows:
The room IDs of source rooms SHOULD be opaque to users and unique across all possible peerhosts, for example by generating a UUID in accordance with RFC 4122 [2] or by hashing the human-readable name of the room using the SHA-256 algorithm in accordance with SHA [3].
This document adds the following terms to those defined in XEP-0045:
In this document, the examples use the following entities.
When the original room owner creates the room (or subsequently configures the room), the service MAY offer the option of making the room a "distributed room". This is done by including the "muc#roomconfig_distributed" feature in the room configuration form:
<iq from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' id='create1' to='scott@example.com/desktop' type='result'> <query xmlns='http://jabber.org/protocol/muc#owner'> <x xmlns='jabber:x:data' type='form'> <field type='hidden' var='FORM_TYPE'> <value>http://jabber.org/protocol/muc#roomconfig</value> </field> ... <field label='Distribute Room Across Multiple Services?' type='boolean' var='muc#roomconfig_distributed'> <value>0</value> </field> ... </x> </query> </iq>
The room owner specifies a value of "1" or "true" [4] if room distribution is desired:
<iq from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' id='configure1' to='scott@example.com/desktop' type='set'> <query xmlns='http://jabber.org/protocol/muc#owner'> <x xmlns='jabber:x:data' type='submit'> <field type='hidden' var='FORM_TYPE'> <value>http://jabber.org/protocol/muc#roomconfig</value> </field> ... <field var='muc#roomconfig_distributed'> <value>true</value> </field> ... </x> </query> </iq>
Alternatively, the firsthost can choose to perform room distribution in the background, rather than exposing the 'muc#roomconfig_distributed' option to the user.
When a firsthost would like a peerhost to provide a shadow, it sends a replication request to the peerhost.
<iq from='firsthost.example.com' id='replicate1' to='peer1.example.net' type='set'> <replicate xmlns='urn:xmpp:dmuc:0'> <room id='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39'/> </replicate> </iq>
If the peerhost is willing and able to replicate the room, it returns an IQ-result:
<iq to='peer1.example.net' id='replicate1' from='firsthost.example.com' type='result'/>
Several error cases are possible (the peerhost is resource constrained, the firsthost is forbidden to peer with the peerhost, etc.); these will be specified more fully in a future version of this specification.
Once the peerhost acknowledges that it is willing and able to replicate the room, four things happen:
<iq from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' id='config1' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' type='set'> <config xmlns='urn:xmpp:dmuc:0'> <x xmlns='jabber:x:data' type='form'> <field type='hidden' var='FORM_TYPE'> <value>http://jabber.org/protocol/muc#roomconfig</value> </field> ... </x> </config> </iq>
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' id='config1' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' type='result'/>
<iq from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' id='roster1' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' type='set'> <roster xmlns='urn:xmpp:dmuc:0'> <item affiliation='owner' jid='scott@example.com/desktop' name='foo'/> <item affiliation='admin' jid='boyd@example.com/laptop' name='bar'/> <item affiliation='none' jid='lorraine@example.com/pda' name='baz'/> </roster> </iq>
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' id='roster1' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' type='result'/>
The new shadow SHOULD request the room history. This is done by sending an IQ-get from the shadow to the source, containing a <history/> element qualified by the 'http://jabber.org/protocol/muc' namespace (the syntax and semantics of this element are described in XEP-0045).
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' id='history1' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' type='get'> <room xmlns='urn:xmpp:dmuc:0' id='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39'> <history xmlns='http://jabber.org/protocol/muc'/> </room> </iq>
The history request MAY include any of the attributes specified in XEP-0045:: 'maxchars', 'maxstanzas', 'seconds', and 'since'.
<iq from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' id='history1' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' type='result'/> <history xmlns='http://jabber.org/protocol/muc'> <message xmlns='jabber:client' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/foo' type='groupchat'> <body>Message 1.</body> <delay xmlns='urn:xmpp:delay' from='scott@example.com/desktop' stamp='2002-10-13T23:58:37Z'/> </message> <message xmlns='jabber:client' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/bar' type='groupchat'> <body>Message 2.</body> <delay xmlns='urn:xmpp:delay' from='boyd@example.com/laptop' stamp='2002-10-13T23:58:43Z'/> </message> <message xmlns='jabber:client' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/baz' type='groupchat'> <body>Message 3.</body> <delay xmlns='urn:xmpp:delay' from='lorraine@example.com/pda' stamp='2002-10-13T23:58:49Z'/> </message> </history> </iq>
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' id='history1' from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' type='result'/>
The firsthost also informs other connected peerhosts about the new peerhost.
<iq from='firsthost.example.com' id='ph1' to='peer2.example.org' type='set'> <peerhost xmlns='urn:xmpp:dmuc:0'> <room id='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39'/> </peerhost> </iq>
<iq from='peer2.example.org' id='ph1' to='firsthost.example.com' type='result'/>
When a user attempts to join a source room, the firsthost determines if it will invite the user to join a shadow at a peerhost instead. The process for determining when to send invitations is implementation specific and might be subject to configuration at the firsthost (e.g., the firsthost might send invitations only to users of a domain associated with the peerhost and only after a certain number of such users have joined the room at the firsthost).
To begin, a user at the peerhost attempts to join the source room at the firsthost:
<presence from='mike@example.net/office' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/krutsch'> <x xmlns='http://jabber.org/protocol/muc'/> </presence>
The source room returns a <redirect/> presence error to the user and invites the user to join a shadow room instead.
<presence from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/baz' to='mike@example.net/office' type='error'> <error type='cancel'> <redirect xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>peer1.example.net</redirect> </error> </presence>
Then the source invites the user to the shadow using the protocol defined in Direct MUC Invitations [5].
<message from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com' to='mike@example.net/office' <x xmlns='jabber:x:conference' jid='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net'/> </message>
The user then joins the shadow.
<presence from='mike@example.net/office' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net/krutsch'> <x xmlns='http://jabber.org/protocol/muc'/> </presence>
The shadow then informs the source (and any other shadows) of the user's presence; it does so by sending presence from the roomjid of the user at the shadow to a roomjid with the same roomnick at the source and shadow(s).
<presence from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net/krutsch' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/krutsch'> <x xmlns='http://jabber.org/protocol/muc#user'> <item affiliation='none' role='participant'/> </x> </presence>
The source then delivers that presence stanza to its local users. (Note: The shadow needs to send only one presence stanza to the source, thus reducing the number of stanzas sent over the server-to-server link between the peerhost and the firsthost.)
When a user sends a message to an instance, the instance sends the message to its local occupants and to other instances.
<message from='mike@example.net/office' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net' type='groupchat'> <body>Message 4.</body> </message>
<message from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net/krutsch' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer2.example.org/krutsch' type='groupchat'> <body>Message 4.</body> </message> <message from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net/krutsch' to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/krutsch' type='groupchat'> <body>Message 4.</body> </message>
The source then delivers that message stanza to its local users. (Note: The shadow needs to send only one message stanza to the source, thus reducing the number of stanzas sent over the server-to-server link between the peerhost and the firsthost.)
To follow.
If a MUC service supports distributed rooms, it MUST return a feature of "urn:xmpp:dmuc:0"
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.
in response to Service Discovery [6] information requests.To follow.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [7].
This document requires no interaction with the XMPP Registrar [8].
Thanks to Jay Carlson, Boyd Fletcher, and Michael Krutsch for their early conversations regarding distributed chatrooms.
To follow.
Series: XEP
Number: 0281
Publisher: XMPP Standards Foundation
Status:
Experimental
Type:
Standards Track
Version: 0.1
Last Updated: 2010-06-11
Approving Body: XMPP Council
Dependencies: XEP-0045, XEP-0030
Supersedes: None
Superseded By: None
Short Name: NOT-YET-ASSIGNED
Source Control:
HTML
RSS
This document in other formats:
XML
PDF
Email:
stpeter@jabber.org
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
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-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.
2. RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace <http://tools.ietf.org/html/rfc4122>.
3. Secure Hash Standard: Federal Information Processing Standards Publication 180-2 <http://csrc.nist.gov/publications/fips/fips180-2/fips186-2withchangenotice.pdf>.
4. In accordance with Section 3.2.2.1 of XML Schema Part 2: Datatypes, the allowable lexical representations for the xs:boolean datatype are the strings "0" and "false" for the concept 'false' and the strings "1" and "true" for the concept 'true'; implementations MUST support both styles of lexical representation.
5. XEP-0249: Direct MUC Invitations <http://xmpp.org/extensions/xep-0249.html>.
6. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.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/
Initial published version.
(psa)Simplified the protocol to use a master-slave approach; modified terminology.
(psa)First draft.
(psa)END