Monday 25 June 2007

Guidelines for Server Active Multicasting on XEP33

Jabber servers and components sometimes send the same stanza to several destinations. Using XEP33 on such situations they could save traffic. I'll now provide some guidelines to implement that feature.

Guidelines

1. If there's a local multicast service, the sender SHOULD send a single stanza with an 'addresses' element as described on XEP33. If no local multicast is available, obviously it MUST send multiple stanzas as usual.

2. Each desired destination address must be included as an 'address' element, as a child of the 'addresses' element, as described on XEP33.

3. All the 'address' elements MUST include the attribute 'jid'. It is not allowed to use the attribute 'uri'.

4. All the 'address' elements MUST include the attribute 'type' with value 'bcc'. It is not allowed to put any other value on this attribute.

5. All the 'address' elements SHOULD NOT include any other attribute, since they will never be presented to the destination entity.


Example

On this example I'll show how a MUC service that follows the proposed guidelines sends a message to all the occupants of a room.

Scenario

On this example, I suppose those JIDs, which are described on
XEP45 sec. 4.3:

  • the Jabber server: shakespeare.lit
  • the multicast service: multicast.shakespeare.lit
  • the MUC service: macbeth.shakespeare.lit
  • the room: darkcave@macbeth.shakespeare.lit
  • the room occupants:
    • crone1@shakespeare.lit/desktop
    • wiccarocks@shakespeare.lit/laptop
    • hag66@shakespeare.lit/pda
Without XEP33

The section 7.9 Sending a Message to All Occupants on XEP45 shows a room occupant that sends a message to the room. Then, the MUC service sends this message to all the room occupants.

The example 60 shows the three stanzas sent by the MUC service to the room occupants:
<message
from='darkcave@macbeth.shakespeare.lit/thirdwitch'
to='crone1@shakespeare.lit/desktop'
type='groupchat'>
<body>Harpier cries: 'tis time, 'tis time.</body>
</message>

<message
from='darkcave@macbeth.shakespeare.lit/thirdwitch'
to='wiccarocks@shakespeare.lit/laptop'
type='groupchat'>
<body>Harpier cries: 'tis time, 'tis time.</body>
</message>

<message
from='darkcave@macbeth.shakespeare.lit/thirdwitch'
to='hag66@shakespeare.lit/pda'
type='groupchat'>
<body>Harpier cries: 'tis time, 'tis time.</body>
</message>


With XEP33

If the MUC service supports XEP33, instead of sending three similar stanzas it sends only one to the multicast service:

<message
from='darkcave@macbeth.shakespeare.lit/thirdwitch'
to='multicast.shakespeare.lit'
type='groupchat'>
<body>Harpier cries: 'tis time, 'tis time.</body>
<addresses xmlns='http://jabber.org/protocol/address'>
<address type='bcc' jid='crone1@shakespeare.lit/desktop'/>
<address type='bcc' jid='wiccarocks@shakespeare.lit/laptop'/>
<address type='bcc' jid='hag66@shakespeare.lit/pda'/>
</addresses>
</message>

No comments: