%ents; ]>
Distributed Multi-User Chat This document defines methods for distributing Multi-User Chat (MUC) rooms across multiple services. &LEGALNOTICE; XXXX ProtoXEP Standards Track Standards XEP-0045 XEP-0030 dmuc &stpeter; 0.0.2 2010-02-05 psa

Simplified the protocol to use a master-slave approach; modified terminology.

0.0.1 2007-06-01 psa

First draft.

&xep0045; 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:

  1. Enable distribution of a MUC room across multiple services.
  2. Enable a service to determine which other services it will peer with.
  3. Enable the room creator to specify if distribution is allowed.
  4. Enable occupants to remain in an instance of the conference if connectivity is lost to other instances.
  5. Enable syncing of history, configuration, and room rosters on reconnect.

The basic approach to distribution of MUC rooms is as follows:

  1. A user creates a room on a service and configures it as "distributed" (or the service assumes that the room is distributed based on local service policy); this first instance of the room is called a SOURCE and the service on which it is created is called a FIRSTHOST.
  2. The firsthost can immediately request that other services (called PEERHOSTS) replicate the room by creating their own local instances (called SHADOWS); alternatively, the firsthost can wait to send the replication request until users from the peerhost have joined the room.
  3. If a user from the peerhost attempts to join the source room after replication is established, the firsthost invites the user to join the shadow rather than the source by sending a direct invitation to the user.
  4. As long as the peerhost and firsthost have connectivity, they share room messages, room rosters, and room configuration changes in real time. If any conflict arises, the firsthost's information rules since it is "first among equals".
  5. If the peerhost loses connectivity to the firsthost, it maintains the shadow, including local room history, room roster, and room configuration, and if possible also maintains connectivity with other peerhosts.
  6. Upon reconnecting to the firsthost, a peerhost exchanges room history and room rosters with the firsthost and receives room configuration data (if modified).

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 &rfc4122; or by hashing the human-readable name of the room using the SHA-256 algorithm in accordance with &nistfips180-2;.

This document adds the following terms to those defined in XEP-0045:

  • Firsthost -- The MUC service at which a room is created.
  • Peerhost -- Any MUC service (other than the firsthost) that hosts an instance of the room.
  • Shadow -- An instance of the room at a peerhost.
  • Source -- The canonical instance of the room at the firsthost.

In this document, the examples use the following entities.

  • Firsthost: firsthost.example.com
  • Peerhosts: peer1.example.net and peer2.example.org
  • Shadows: f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net and f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer2.example.org
  • Source: f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com

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:

http://jabber.org/protocol/muc#roomconfig ... 0 ... ]]>

The room owner specifies a value of "1" or "true" &BOOLEANNOTE; if room distribution is desired:

http://jabber.org/protocol/muc#roomconfig ... true ... ]]>

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.

]]>

If the peerhost is willing and able to replicate the room, it returns an IQ-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:

  1. The source sends the room configuration to the shadow.
  2. The source sends the room roster to the shadow.
  3. The shadow optinoally requests the room history from the source.
  4. The firsthost informs other peerhosts about the new peerhost.
http://jabber.org/protocol/muc#roomconfig ... ]]> ]]> ]]> ]]>

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).

]]>

The history request MAY include any of the attributes specified in XEP-0045:: 'maxchars', 'maxstanzas', 'seconds', and 'since'.

Message 1. Message 2. Message 3. ]]> ]]>

The firsthost also informs other connected peerhosts about the new peerhost.

]]> ]]>

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:

]]>

The source room returns a <redirect/> presence error to the user and invites the user to join a shadow room instead.

peer1.example.net ]]>

Then the source invites the user to the shadow using the protocol defined in &xep0249;.

]]>

The user then joins the shadow.

]]>

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).

]]>

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 4. ]]> Message 4. Message 4. ]]>

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" &NSVER; in response to &xep0030; information requests.

To follow.

This document requires no interaction with &IANA;.

This document requires no interaction with the ®ISTRAR;.

Thanks to Jay Carlson, Boyd Fletcher, and Michael Krutsch for their early conversations regarding distributed chatrooms.

To follow.