%ents; ]>
DMUC2: Distributed MUC Multi-User Chats, distributed over several nodes in the XMPP network, using a primary/replica architecture &LEGALNOTICE; 0282 Deferred Standards Track Standards Council XMPP Core XEP-0045 NOT-YET-ASSIGNED Carlo von Loesch lynx@psyced.org Philipp Hancke fippo@ve.symlynx.com 0.1.1 2021-03-04 mw

Cross-document editorial adjustments for inclusive language.

0.1 2010-06-11 psa

Initial published version.

0.0.1 2010-03-15 cvl/ph

First draft.

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.

The architecture is that of a single root node, called PRIMARY and several repeater nodes, each called REPLICA. Every stanza is submitted via the replicas to the primary, control is centralized there. The primary then sends a copy of the stanza to each of the replicas where it is processed and then distributed to each of the replica's leaf nodes, local users at this point. During redistribution, the replica shall not change the stanza's 'from' attribute, which is only possible if the replica is in the same security domain as the user. The result of that is a decreased number of messages on the server-to-server links between the primary's server and each of the replica servers.

vesa.yeggmaex.irc ----> wallops MUC ----> killrc.oulubox.irc ----> Wumpus killrc.oulubox.irc ----> Phaedrus killrc.oulubox.irc ----> Valdis wallops MUC ----> eris.dclxvii.irc ----> WiZ eris.dclxvii.irc ----> Troy wallops MUC ----> vesa.yeggmaex.irc ----> BigCheese vesa.yeggmaex.irc ----> Efchen ]]>

Note that this only applies to stanzas that are directed to all occupants, such as the change of availability status and messages whose 'type' attribute is set to 'groupchat'.

While 1-1 stanzas such as in-room private messages or vcard-temp requests may also travel along that path they are currently unaffected by this.

This specification addresses the following requirements:

Most of the examples in this document use the scenario of the 1990 war that split the Internet Relay Chat into several incompatible networks. The battlefield is represented here by the "wallops@channel.avalon.irc" chatroom. The characters are as follows:

Room Nickname Full JID Role
Wumpus argl@killrc.oulubox.irc/laptop Moderator
Valdis valdis@killrc.oulubox.irc/desktop Participant
Phaedrus phaedrus@killrc.oulubox.irc/phone Participant
WiZ squit@eris.dclxvii.irc/jupiter Moderator
Troy troy@eris.dclxvii.irc/screwdriver Moderator
BigCheese rubenro@vesa.yeggmaex.irc/shaver Participant
Efchen msa@vesa.yeggmaex.irc/bicycle Participant

In our example we are presuming that three replicas from three hosts have registered with the primary for traffic redistribution. They are doing so using replica@host jids, but they could be using any temporary jid the implementor finds useful to choose.

This section describes the protocol between the primary and the replicas, the interaction between each replica and its users are described in the next section.

The replica

  • must be able to intercept any stanzas sent to the primary's jid,
  • must be able to verify if a local user has sent directed presence to the primary's jid,
  • must store room roster,
  • must store local room roster
  • must store room history (if desired by primary)

to follow

Might include things like negotiation of keepalive frequency and amount of room might be useful to set some things like keepalive frequency, keeping/storing room history etc.

After the creation of a new replica, the primary must send the room roster (which at that time only consists of remote participants) to the replica:

]]>

After the creation of a new replica, the primary MAY also send the discussion history to the replica. The replica shall store this and deliver it to entering participants.

from=primaryjid to=replicajid?

If a new occupant requests to enter the room, the primary first sends a presence update to all participants to inform them of the presence of the new user. Then, the primary sends the affected replica a stanza requesting it to add the user to the distribution list

... ]]>

The replica MUST verify that the user has sent directed presence to the primary's JID before. This helps to ensure that the user intended to enter the room. If this is ture, the replica shall add the user to the distribution list and send the room roster, occupants own presence in room and discussion history to the full jid of the added user.

If an occupant sends an unavailable presence to the room, the primary sends the affected replica a stanza requesting it to remove the user from the distribution list.

... ]]>

The replica removes user and forwards the stanza to user.

The primary then sends a presence update to all replicas to announce the occupants departure.

Presence updates are distributed by the primary to all replicas.

... ... ... ]]>

Note that the primary MUST NOT send the full jid of the user to any replicas without members that are moderators.

When rebroadcasting this stanza to its local occupants, the replica MUST remove the participants full JID subject to the rules of XEP-0045. In addition, the replica stores the resulting changes to the room roster, so that it can send the correct state to entering users.

The replica may relay messages from local users to the primary. When doing so, it MUST NOT modify the stanzas 'from' attribute but MUST retain the original address of the sender.

Phaedrus, we're all having a truly rotten time. ]]>

When relaying a message, the primary SHOULD add a urn:xmpp:delay element inside dmuc element so that the replica can provide proper timestamps to new users. The primary then sends a copy of the stanza to each replica.

Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. ]]>

After saving the stanza for the purpose of keeping a room history, the replica SHOULD remove the urn:xmpp:tmp:dmuc:0 element and send the stanza to each local user.

To ensure a working connecting, the primary SHOULD send an XMPP Ping stanza to each replica if there has been no traffic for a certain amount of time.

Likewise, each replica should ping the primary if there has been no traffic for more than the usual amount of time.

A 'lost connection' can be detected by either replica or primary when a stanza sent to the primary or a replica respectively bounced.

If the primary receives a stanza with type=error from the replica JID, it MUST:

  • mark the replica as 'split', making sure that any further broadcasts are not sent to the affected replica
  • start sending pings to the replica with a higher frequency to get a timely notification if the replica reappears
  • resync when the replica reappears as described below

In addition, the primary MAY send a presence update for each user on the affected replica, marking them as away.

If the replica receives a stanza with type=error from the primary's JID, it MUST:

  • stop submitting messages to the primary
  • react to people sending presence updates or leaving the room and broadcast those changes to local users

In addition, the replica MAY (and be careful when using this):

  • enable local participants to continue their in-room conversation with other local participants
  • enable local participants to continue 1-1 messaging in the context of a room (such as private chat or vcard retrieval)
  • enable local users to enter the room (DANGER!!!)
  • enable moderators (as designated by the primary) to kick participants
  • mark non-local users as away

to follow

This section narratively describes the primary-replica protocol in context with client interactions.

The user seeks to enter the wallops chatroom with the room nickname BigCheese:

]]>

The primary sends the presence update to each replica to inform the current occupants of BigCheese's arrival:

... ... ... ]]>

Each replica then distributes this presence update:

... ... ... ]]> ... ... ]]> ... ]]>

The primary then informs the replica of the entered user about a new occupant:

... ]]>

The replica sends presence from existing occupants to new occupant:

]]>

and concludes the room roster by sending the new occupant's presence to the new occupant:

]]>

After that, the replica will send the discussion history to the new occupant:

Honest! He did!! Was that absolutely necessary???????? SUUUUUUURE he did He did. really truly he did. ]]>
Phaedrus, we're all having a truly rotten time. ]]>

The primary will broadcast this message to all replicas:

Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. ]]>

And each replica distributes to local occupants

Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. ]]> Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. ]]> Phaedrus, we're all having a truly rotten time. Phaedrus, we're all having a truly rotten time. ]]>

to follow

Careful with channel overtakes :-)

This document requires no interaction with &IANA;.

This document requires no interaction with the ®ISTRAR;.

to follow