1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-28 04:02:20 -05:00

initial version

git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@4237 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2010-06-11 19:04:04 +00:00
parent fb758fbca1
commit 8a89c059c1
2 changed files with 1056 additions and 0 deletions

390
xep-0281.xml Normal file
View File

@ -0,0 +1,390 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
<!ENTITY ROOM "&lt;room@service&gt;">
<!ENTITY ROOMJID "&lt;room@service/nick&gt;">
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>DMUC1: Distributed Multi-User Chat</title>
<abstract>This document defines methods for distributing Multi-User Chat (MUC) rooms across multiple chat services.</abstract>
&LEGALNOTICE;
<number>0281</number>
<status>Experimental</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XEP-0045</spec>
<spec>XEP-0030</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>NOT-YET-ASSIGNED</shortname>
&stpeter;
<revision>
<version>0.1</version>
<date>2010-06-11</date>
<initials>psa</initials>
<remark><p>Initial published version.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2010-02-05</date>
<initials>psa</initials>
<remark><p>Simplified the protocol to use a master-slave approach; modified terminology.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2007-06-01</date>
<initials>psa</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p class='box'><em>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.</em></p>
<section2 topic='Motivation' anchor='motivation'>
<p>&xep0045; defines a full-featured technology for multi-user text conferencing in XMPP. By design, <cite>XEP-0045</cite> 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.</p>
</section2>
<section2 topic='Requirements' anchor='requirements'>
<p>This specification addresses the following requirements:</p>
<ol start="1">
<li>Enable distribution of a MUC room across multiple services.</li>
<li>Enable a service to determine which other services it will peer with.</li>
<li>Enable the room creator to specify if distribution is allowed.</li>
<li>Enable occupants to remain in an instance of the conference if connectivity is lost to other instances.</li>
<li>Enable syncing of history, configuration, and room rosters on reconnect.</li>
</ol>
</section2>
<section2 topic='Approach' anchor='approach'>
<p>The basic approach to distribution of MUC rooms is as follows:</p>
<ol start="1">
<li>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.</li>
<li>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.</li>
<li>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.</li>
<li>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".</li>
<li>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.</li>
<li>Upon reconnecting to the firsthost, a peerhost exchanges room history and room rosters with the firsthost and receives room configuration data (if modified).</li>
</ol>
<p>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;.</p>
</section2>
</section1>
<section1 topic='Terminology' anchor='terms'>
<section2 topic='General Terms' anchor='terms-general'>
<p>This document adds the following terms to those defined in <cite>XEP-0045</cite>:</p>
<ul>
<li>Firsthost -- The MUC service at which a room is created.</li>
<li>Peerhost -- Any MUC service (other than the firsthost) that hosts an instance of the room.</li>
<li>Shadow -- An instance of the room at a peerhost.</li>
<li>Source -- The canonical instance of the room at the firsthost.</li>
</ul>
</section2>
<section2 topic='Entities' anchor='terms-entities'>
<p>In this document, the examples use the following entities.</p>
<ul>
<li>Firsthost: firsthost.example.com</li>
<li>Peerhosts: peer1.example.net and peer2.example.org</li>
<li>Shadows: f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net and f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer2.example.org</li>
<li>Source: f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com</li>
</ul>
</section2>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Creating a Room' anchor='create'>
<p>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:</p>
<example caption='Service Sends Configuration Form'><![CDATA[
<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>
]]></example>
<p>The room owner specifies a value of "1" or "true" &BOOLEANNOTE; if room distribution is desired:</p>
<example caption='Room Owner Submits Configuration Form'><![CDATA[
<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>
]]></example>
<p>Alternatively, the firsthost can choose to perform room distribution in the background, rather than exposing the 'muc#roomconfig_distributed' option to the user.</p>
</section2>
<section2 topic='Replicating a Room' anchor='replication'>
<p>When a firsthost would like a peerhost to provide a shadow, it sends a replication request to the peerhost.</p>
<example caption='Firsthost Requests Replication of Room'><![CDATA[
<iq from='firsthost.example.com'
id='replicate1'
to='peer1.example.net'
type='set'>
<replicate xmlns='urn:xmpp:dmuc:0'>
<room id='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39'/>
</replicate>
</iq>
]]></example>
<p>If the peerhost is willing and able to replicate the room, it returns an IQ-result:</p>
<example caption='Peerhost Acknowledges Replication Request'><![CDATA[
<iq to='peer1.example.net'
id='replicate1'
from='firsthost.example.com'
type='result'/>
]]></example>
<p>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.</p>
<p>Once the peerhost acknowledges that it is willing and able to replicate the room, four things happen:</p>
<ol start="1">
<li>The source sends the room configuration to the shadow.</li>
<li>The source sends the room roster to the shadow.</li>
<li>The shadow optinoally requests the room history from the source.</li>
<li>The firsthost informs other peerhosts about the new peerhost.</li>
</ol>
<example caption='Source Sends Room Configuration to Shadow'><![CDATA[
<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>
]]></example>
<example caption='Shadow Acknowledges Receipt of Room Configuration'><![CDATA[
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net'
id='config1'
from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com'
type='result'/>
]]></example>
<example caption='Source Sends Room Roster to Shadow'><![CDATA[
<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>
]]></example>
<example caption='Shadow Acknowledges Receipt of Room Roster'><![CDATA[
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net'
id='roster1'
from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com'
type='result'/>
]]></example>
<p>The new shadow SHOULD request the room history. This is done by sending an IQ-get from the shadow to the source, containing a &lt;history/&gt; element qualified by the 'http://jabber.org/protocol/muc' namespace (the syntax and semantics of this element are described in <cite>XEP-0045</cite>).</p>
<example caption='Peerhost Requests Room History'><![CDATA[
<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>
]]></example>
<p>The history request MAY include any of the attributes specified in <cite>XEP-0045:</cite>: 'maxchars', 'maxstanzas', 'seconds', and 'since'.</p>
<example caption='Firsthost Sends Room History to Peerhost'><![CDATA[
<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>
]]></example>
<example caption='Peerhost Acknowledges Receipt of Room History'><![CDATA[
<iq to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net'
id='history1'
from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com'
type='result'/>
]]></example>
<p>The firsthost also informs other connected peerhosts about the new peerhost.</p>
<example caption='Firsthost Reports New Peerhost'><![CDATA[
<iq from='firsthost.example.com'
id='ph1'
to='peer2.example.org'
type='set'>
<peerhost xmlns='urn:xmpp:dmuc:0'>
<room id='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39'/>
</peerhost>
</iq>
]]></example>
<example caption='Peerhost Acknowledges Notification of New Peerhost'><![CDATA[
<iq from='peer2.example.org'
id='ph1'
to='firsthost.example.com'
type='result'/>
]]></example>
</section2>
<section2 topic='Joining a Room' anchor='join'>
<p>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).</p>
<p>To begin, a user at the peerhost attempts to join the source room at the firsthost:</p>
<example caption='User Seeks to Join Source Room'><![CDATA[
<presence
from='mike@example.net/office'
to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com/krutsch'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
]]></example>
<p>The source room returns a &lt;redirect/&gt; presence error to the user and invites the user to join a shadow room instead.</p>
<example caption='Source Informs User of a Shadow'><![CDATA[
<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>
]]></example>
<p>Then the source invites the user to the shadow using the protocol defined in &xep0249;.</p>
<example caption='Source Invites User to a Shadow'><![CDATA[
<message
from='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@firsthost.example.com'
to='mike@example.net/office'
<x xmlns='jabber:x:conference'
jid='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net'/>
</message>
]]></example>
<p>The user then joins the shadow.</p>
<example caption='User Joins Shadow'><![CDATA[
<presence
from='mike@example.net/office'
to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net/krutsch'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
]]></example>
<p>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).</p>
<example caption='Shadow Informs Source of New Occupant'><![CDATA[
<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>
]]></example>
<p>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.)</p>
</section2>
<section2 topic='Sending a Message' anchor='send'>
<p>When a user sends a message to an instance, the instance sends the message to its local occupants and to other instances.</p>
<example caption='User Sends Message'><![CDATA[
<message
from='mike@example.net/office'
to='f609923deb78718a125b93d32609bd5265dd927242ac93a99eb366109df2bd39@peer1.example.net'
type='groupchat'>
<body>Message 4.</body>
</message>
]]></example>
<example caption='Instance Distributes Message'><![CDATA[
<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>
]]></example>
<p>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.)</p>
</section2>
<section2 topic='sync' anchor='Re-Syncing after Connectivity Loss'>
<p>To follow.</p>
</section2>
</section1>
<section1 topic='Determining Support' anchor='support'>
<p>If a MUC service supports distributed rooms, it MUST return a feature of "urn:xmpp:dmuc:0" &NSVER; in response to &xep0030; information requests.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>To follow.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='reg'>
<p>This document requires no interaction with the &REGISTRAR;.</p>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Jay Carlson, Boyd Fletcher, and Michael Krutsch for their early conversations regarding distributed chatrooms.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>To follow.</p>
</section1>
</xep>

666
xep-0282.xml Normal file
View File

@ -0,0 +1,666 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>DMUC2: Distributed MUC</title>
<abstract>Multi-User Chats, distributed over several nodes in the XMPP network, using a master/slave architecture</abstract>
&LEGALNOTICE;
<number>0282</number>
<status>Experimental</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0045</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>NOT-YET-ASSIGNED</shortname>
<author>
<firstname>Carlo</firstname>
<surname>von Loesch</surname>
<jid>lynx@psyced.org</jid>
</author>
<author>
<firstname>Philipp</firstname>
<surname>Hancke</surname>
<jid>fippo@ve.symlynx.com</jid>
</author>
<revision>
<version>0.1</version>
<date>2010-06-11</date>
<initials>psa</initials>
<remark><p>Initial published version.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2010-03-15</date>
<initials>cvl/ph</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p class='box'><em>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.</em></p>
<p>The architecture is that of a single root node, called MASTER and several repeater nodes, each called SLAVE. Every stanza is submitted via the slaves to the master, control is centralized there. The master then sends a copy of the stanza to each of the slaves where it is processed and then distributed to each of the slave's leaf nodes, local users at this point. During redistribution, the slave shall not change the stanza's 'from' attribute, which is only possible if the slave 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 master's server and each of the slave servers.</p>
<code><![CDATA[
BigCheese ----> 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
]]></code>
<p>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'.</p>
<p>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.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>This specification addresses the following requirements:</p>
<ul>
<li>The existence of the slave shall be transparent for the user.</li>
<li>Enable detection of connection loss.</li>
<li>Enable occupants to remain in instance of the conference if connectivity is lost to other instances.</li>
<li>Enable occupants to leave a chatroom while connectivity is lost.</li>
<li>Enable syncing of history and room rosters on reconnect.</li>
<li>Improve distribution of 'broadcast' stanzas'.</li>
</ul>
</section1>
<section1 topic='Terminology' anchor='terms'>
<!--
<section2 topic='General Terms' anchor='terms-general'>
<dl>
<di>
<dt>Master</dt>
<dd></dd>
</di>
<di>
<dt>Slave</dt>
<dd></dd>
</di>
<di>
<dt>Netsplit</dt>
<dd></dd>
</di>
<di>
<dt>CASTMSG</dt>
<dd>wut? you don't need this</dd>
</di>
<di>
<dt>ENTER</dt>
<dd>?</dd>
</di>
<di>
<dt>LEAVE</dt>
<dd>?</dd>
</di>
</dl>
</section2>
-->
<section2 topic='Dramatis Personae' anchor='terms-personae'>
<p>Most of the examples in this document use the scenario of the 1990 war that split the <cite>Internet Relay Chat</cite> into several incompatible networks. The battlefield is represented here by the "wallops@channel.avalon.irc" chatroom. The characters are as follows:</p>
<table caption='Dramatis Personae'>
<tr>
<th>Room Nickname</th>
<th>Full JID</th>
<th>Role</th>
</tr>
<tr>
<td>Wumpus</td>
<td>argl@killrc.oulubox.irc/laptop</td>
<td>Moderator</td>
</tr>
<tr>
<td>Valdis</td>
<td>valdis@killrc.oulubox.irc/desktop</td>
<td>Participant</td>
</tr>
<tr>
<td>Phaedrus</td>
<td>phaedrus@killrc.oulubox.irc/phone</td>
<td>Participant</td>
</tr>
<tr>
<td>WiZ</td>
<td>squit@eris.dclxvii.irc/jupiter</td>
<td>Moderator</td>
</tr>
<tr>
<td>Troy</td>
<td>troy@eris.dclxvii.irc/screwdriver</td>
<td>Moderator</td>
</tr>
<tr>
<td>BigCheese</td>
<td>rubenro@vesa.yeggmaex.irc/shaver</td>
<td>Participant</td>
</tr>
<tr>
<td>Efchen</td>
<td>msa@vesa.yeggmaex.irc/bicycle</td>
<td>Participant</td>
</tr>
</table>
<p>In our example we are presuming that three slaves from three hosts have registered with the master for traffic redistribution. They are doing so using slave@host jids, but they could be using any temporary jid the implementor finds useful to choose.</p>
</section2>
</section1>
<section1 topic='MASTER/SLAVE Protocol' anchor='masterslave'>
<p>This section describes the protocol between the master and the slaves, the interaction between each slave and its users are described in the next section.</p>
<!--
<section2 topic='Narrative Protocol Description'>
<p>some blabla</p>
</section2>
-->
<section2 topic='Slave Requirements'>
<p>The slave</p>
<ul>
<li>must be able to intercept any stanzas sent to the masters jid,</li>
<li>must be able to verify if a local user has sent directed presence to the masters jid,</li>
<li>must store room roster,</li>
<li>must store local room roster</li>
<li>must store room history (if desired by master)</li>
</ul>
</section2>
<section2 topic='Creating a Slave'>
<p>to follow</p>
<p>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.</p>
<!--
<p>maxstanzas / maxbytes attribute</p>
<p>PARANOIA: why should the slave let the master create the slave and send room roster and history?</p>
-->
</section2>
<section2 topic='Initial Room Roster'>
<p>After the creation of a new slave, the master must send the room roster (which at that time only consists of remote participants) to the slave:</p>
<example caption="Master Sends Room Roster to Slave"><![CDATA[
<presence
from='wallops@channel.avalon.irc/Wumpus'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='owner' role='moderator'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Valdis'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none' role='participant'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Phaedrus'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none' role='participant'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/WiZ'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='admin' role='moderator'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Troy'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='participant' role='moderator'/>
</x>
</presence>]]></example>
<!--
<p>Tricky: if this does not contain the full jid, the (initial) presence information sent to moderators that join later will not be possible... mh!</p>
-->
</section2>
<section2 topic='Initial Room History'>
<p>After the creation of a new slave, the master MAY also send the discussion history to the slave. The slave shall store this and deliver it to entering participants.</p>
<p>from=masterjid to=slavejid?</p>
</section2>
<section2 topic='ENTER'>
<p>If a new occupant requests to enter the room, the master first sends a presence update to all participants to inform them of the presence of the new user. Then, the master sends the affected slave a stanza requesting it to add the user to the distribution list</p>
<example caption="Master informs Slave of New Occupant"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<enter jid='rubenro@vesa.yeggmaex.irc/shaver'/>
<history maxstanzas='20'/>
</x>
...
</presence>]]></example>
<p>The slave MUST verify that the user has sent directed presence to the masters JID before. This helps to ensure that the user intended to enter the room. If this is ture, the slave 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.</p>
</section2>
<section2 topic='LEAVE'>
<p>If an occupant sends an unavailable presence to the room, the master sends the affected slave a stanza requesting it to remove the user from the distribution list.</p>
<example caption="Master informs Slave of Occupant's Departure"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'
type='unavailable'>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<leave jid='rubenro@vesa.yeggmaex.irc/shaver'/>
</x>
...
</presence>]]></example>
<p>The slave removes user and forwards the stanza to user.</p>
<p>The master then sends a presence update to all slaves to announce the occupants departure.</p>
</section2>
<section2 topic='Presence Update'>
<p>Presence updates are distributed by the master to all slaves.</p>
<example caption="Master sends presence update"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@killrc.oulubox.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@eris.dclxvii.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'>
...
</presence>]]></example>
<p>Note that the master MUST NOT send the full jid of the user to any slaves without members that are moderators.</p>
<p>When rebroadcasting this stanza to its local occupants, the slave MUST remove the participants full JID subject to the rules of XEP-0045. In addition, the slave stores the resulting changes to the room roster, so that it can send the correct state to entering users.</p>
</section2>
<section2 topic='Slave Forwards Stanza to Master'>
<p>The slave may relay messages from local users to the master. When doing so, it MUST NOT modify the stanzas 'from' attribute but MUST retain the original address of the sender.</p>
<!--
<p>Die Regel ist relativ einfach... from=fulljid to=masterjid/undevtlresource</p>
<p>fulljid deshalb, damit der master nicht checken muss ob der jeweilige user auf dem slave ist und ausserdem der jeweilige user nicht zwangsläufig im Raum sein muss...</p>
<p>Beispiele: message submit, presence update, privatchat innerhalb raum, vcard avatar get</p>
-->
<example caption="Slave Relays a Message to the Master"><![CDATA[
<message
from='rubenro@vesa.yeggmaex.irc/shaver'
to='wallops@channel.avalon.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>]]></example>
<!--
<p>Some rules:</p>
<ul>
<li>The stanzas 'from' attribute MUST be retained.</li>
<li>Stanzas from participants and non-participants must be routed</li>
</ul>
-->
</section2>
<section2 topic='Message Broadcast'>
<p>When relaying a message, the master SHOULD add a urn:xmpp:delay element inside dmuc element so that the slave can provide proper timestamps to new users. The master then sends a copy of the stanza to each slave.</p>
<example caption="Message from Master to all Slaves"><![CDATA[
<message
from='wallops@channel.avalon.irc/BigCheese'
to='slave@killrc.oulubox.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BigCheese'
stamp='1990-10-13T23:58:37Z'/>
</x>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='slave@eris.dclxvii.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BigCheese'
stamp='1990-10-13T23:58:37Z'/>
</x>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BigCheese'
stamp='1990-10-13T23:58:37Z'/>
</x>
</message>]]></example>
<p>After saving the stanza for the purpose of keeping a room history, the slave SHOULD remove the urn:xmpp:tmp:dmuc:0 element and send the stanza to each local user.</p>
</section2>
<section2 topic='Master-Slave Keepalive'>
<p>To ensure a working connecting, the master SHOULD send an XMPP Ping stanza to each slave if there has been no traffic for a certain amount of time.</p>
<p>Likewise, each slave should ping the master if there has been no traffic for more than the usual amount of time.</p>
</section2>
<section2 topic='Netsplit' anchor='netsplit'>
<section3 topic='Netsplit Detection' anchor='netsplit-detect'>
<p>A 'lost connection' can be detected by either slave or master when a stanza sent to the master or a slave respectively bounced.</p>
<section4 topic='At the Master'>
<p>If the master receives a stanza with type=error from the slave JID, it MUST:</p>
<ul>
<li>mark the slave as 'split', making sure that any further broadcasts are not sent to the affected slave</li>
<li>start sending pings to the slave with a higher frequency to get a timely notification if the slave reappears</li>
<li>resync when the slave reappears as described below</li>
</ul>
<p>In addition, the master MAY send a presence update for each user on the affected slave, marking them as away.</p>
</section4>
<section4 topic='At the Slave'>
<p>If the slave receives a stanza with type=error from the master's JID, it MUST:</p>
<ul>
<li>stop submitting messages to the master</li>
<li>react to people sending presence updates or leaving the room and broadcast those changes to local users</li>
</ul>
<p>In addition, the slave MAY (and be careful when using this):</p>
<ul>
<li>enable local participants to continue their in-room conversation with other local participants</li>
<li>enable local participants to continue 1-1 messaging in the context of a room (such as private chat or vcard retrieval)</li>
<li>enable local users to enter the room (DANGER!!!)</li>
<li>enable moderators (as designated by the master) to kick participants</li>
<li>mark non-local users as away</li>
</ul>
</section4>
</section3>
<section3 topic='Netjoin' anchor='netjoin'>
<p>to follow</p>
</section3>
</section2>
</section1>
<section1 topic='Use-Cases' anchor='Uses-Cases'>
<p>This section narratively describes the master-slave protocol in context with client interactions.</p>
<section2 topic='Entering a Room' anchor='enter'>
<p>The user seeks to enter the wallops chatroom with the room nickname BigCheese:</p>
<example caption="User Seeks to Enter Room"><![CDATA[
<presence
from='rubenro@vesa.yeggmaex.irc/shaver'
to='wallops@channel.avalon.irc/BigCheese'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>]]></example>
<p>The master sends the presence update to each slave to inform the current occupants of BigCheese's arrival:</p>
<example caption="Master Sends Presence Update to all Slaves"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@killrc.oulubox.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@eris.dclxvii.irc'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'>
...
</presence>]]></example>
<p>Each slave then distributes this presence update:</p>
<example caption="Slaves Distribute Presence Update to Users - killrc Slave"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='argl@killrc.oulubox.irc/laptop'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='valdis@killrc.oulubox.irc/desktop'>
...
</presence>
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='phaedrus@killrc.oulubox.irc/phone'>
...
</presence>]]></example>
<example caption="Slaves Distribute Presence Update to Users - eris Slave"><![CDATA[
<presence
from='wallops@channel.avalon.irc/WiZ'
to='squit@eris.dclxvii.irc/jupiter'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>
<presence
from='wallops@channel.avalon.irc/WiZ'
to='troy@eris.dclxvii.irc/screwdriver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none'
jid='rubenro@vesa.yeggmaex.irc/shaver'
role='participant'/>
</x>
...
</presence>]]></example>
<example caption="Slaves Distribute Presence Update to Users - vesa Slave"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='rubenro@vesa.yeggmaex.irc/shaver'>
...
</presence>]]></example>
<p>The master then informs the slave of the entered user about a new occupant:</p>
<example caption="Master Informs Slave of New Occupant"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<enter jid='rubenro@vesa.yeggmaex.irc/shaver'/>
</x>
...
</presence>]]></example>
<p>The slave sends presence from existing occupants to new occupant:</p>
<example caption='Slave Sends Presence from Existing Occupants to New Occupant'><![CDATA[
<presence
from='wallops@channel.avalon.irc/Wumpus'
to='rubenro@vesa.yeggmaex.irc/shaver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='owner' role='moderator'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Valdis'
to='rubenro@vesa.yeggmaex.irc/shaver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none' role='participant'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Phaedrus'
to='rubenro@vesa.yeggmaex.irc/shaver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none' role='participant'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/WiZ'
to='rubenro@vesa.yeggmaex.irc/shaver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='admin' role='moderator'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Troy'
to='rubenro@vesa.yeggmaex.irc/shaver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='participant' role='moderator'/>
</x>
</presence>
<presence
from='wallops@channel.avalon.irc/Efchen'
to='rubenro@vesa.yeggmaex.irc/shaver'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='none' role='participant'/>
</x>
</presence>]]></example>
<p>and concludes the room roster by sending the new occupant's presence to the new occupant:</p>
<example caption="Slave Sends New Occupant's Presence to New Occupant"><![CDATA[
<presence
from='wallops@channel.avalon.irc/BigCheese'
to='rubenro@vesa.yeggmaex.irc/shaver'
...
</presence>]]></example>
<p>After that, the slave will send the discussion history to the new occupant:</p>
<example caption='Slave Sends Discussion History to New Occupant'><![CDATA[
<message from='wallops@channel.avalon.irc/Trillian'
to='rubenro@vesa.yeggmaex.irc/shaver'
type='groupchat'>
<body>Honest! He did!!</body>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/Trillian'
stamp='1990-01-23T19:50:01Z'/>
</message>
<message from='wallops@channel.avalon.irc/BlondeBoy'
to='rubenro@vesa.yeggmaex.irc/shaver'
type='groupchat'>
<body>Was that absolutely necessary????????</body>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BlondeBoy'
stamp='1990-01-23T19:50:30Z'/>
</message>
<message from='wallops@channel.avalon.irc/DCLXVI'
to='rubenro@vesa.yeggmaex.irc/shaver'
type='groupchat'>
<body>SUUUUUUURE he did</body>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/DCLXVI'
stamp='1990-01-23T19:50:51Z'/>
</message>
<message from='wallops@channel.avalon.irc/Cerebus'
to='rubenro@vesa.yeggmaex.irc/shaver'
type='groupchat'>
<body>He did. really truly he did.</body>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/Cerebus'
stamp='1990-01-23T19:51:20Z'/>
</message>
]]></example>
</section2>
<section2 topic='Sending a Message to All Occupants' anchor='msg'>
<example caption="Occupant Sends a Message to All Occupants"><![CDATA[
<message
from='rubenro@vesa.yeggmaex.irc/shaver'
to='wallops@channel.avalon.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>]]></example>
<p>The master will broadcast this message to all slaves:</p>
<example caption="Master Distributes Message to all Slaves"><![CDATA[
<message
from='wallops@channel.avalon.irc/BigCheese'
to='slave@killrc.oulubox.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BigCheese'
stamp='1990-10-13T23:58:37Z'/>
</x>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='slave@eris.dclxvii.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BigCheese'
stamp='1990-10-13T23:58:37Z'/>
</x>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='slave@vesa.yeggmaex.irc'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
<x xmlns='urn:xmpp:tmp:dmuc:0'>
<delay xmlns='urn:xmpp:delay'
from='wallops@channel.avalon.irc/BigCheese'
stamp='1990-10-13T23:58:37Z'/>
</x>
</message>]]></example>
<p>And each slave distributes to local occupants</p>
<example caption="Slave Distributes Message to Occupants - killrc Slave"><![CDATA[
<message
from='wallops@channel.avalon.irc/BigCheese'
to='argl@killrc.oulubox.irc/laptop'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='valdis@killrc.oulubox.irc/desktop'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='phaedrus@killrc.oulubox.irc/phone'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>]]></example>
<example caption="Slave Distributes Message to Occupants - eris Slave"><![CDATA[
<message
from='wallops@channel.avalon.irc/BigCheese'
to='squit@eris.dclxvii.irc/jupiter'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='troy@eris.dclxvii.irc/screwdriver'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>]]></example>
<example caption="Slave Distributes Message to Occupants - vesa Slave"><![CDATA[
<message
from='wallops@channel.avalon.irc/BigCheese'
to='rubenro@vesa.yeggmaex.irc/shaver'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>
<message
from='wallops@channel.avalon.irc/BigCheese'
to='msa@vesa.yeggmaex.irc/bicycle'
type='groupchat'>
<body>Phaedrus, we're all having a truly rotten time.</body>
</message>]]></example>
</section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>to follow</p>
<p>Careful with channel overtakes :-)</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>This document requires no interaction with the &REGISTRAR;.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>to follow</p>
</section1>
</xep>