XEP-0311: MUC Fast Reconnect

This document provides a protocol that can be used for limiting the amount of presence history needed when rejoining a MUC room.
Kevin Smith
© 2012 – 2012 XMPP Standards Foundation. SEE LEGAL NOTICES.


WARNING: This document has been automatically Deferred after 12 months of inactivity in its previous Experimental state. Implementation of the protocol described herein is not recommended for production systems. However, exploratory implementations are encouraged to resume the standards process.
Standards Track
0.1 (2012-01-25)
Document Lifecycle
  1. Experimental
  2. Deferred
  3. Proposed
  4. Stable
  5. Final

1. Introduction

A client joining a Multi-User Chat (XEP-0045) [1] room will receive a significant volume of data, in the form of presence from the current room occupants and past ("context" or "history") messages. If the client has recently been in the room (for example if it has needed to reconnect only because of a networking error) it may already know most of the current state, and receipt of these data will be redundant. XEP-0045 provides a method for limiting the context messages received when joining but no method for limiting the duplication of known presence; this document expands slightly upon the former and provides the latter.

2. Requirements

Reduce the volume of redundant data sent to a client.

3. Discovery

MUC Rooms supporting this should have a disco feature of "urn:xmpp:presence-session:0".

To avoid extra roundtrips for discovery, clients may speculatively send elements when initially joining a MUC, and treat the absense of appropriate elements in the responses to indicate a lack of support.

4. Use Cases

4.1 Initial Join

In this example, Romeo (romeo@montague.lit) is joining the MUC room orchard@chats.capulet.lit. To use MUC Fast Reconnect for future joins, the initial MUC join presence stanza MUST also contain a presence-session element in the namespace "urn:xmpp:presence-session:0" with no attributes.

Example 1. Romeo sends 'room join' presence
  <x xmlns='http://jabber.org/protocol/muc'/>
  <presence-session xmlns="urn:xmpp:presence-session:0"/>

If a client has indicated that it's using MUC Fast Reconnect on its session, the MUC service MUST annotate the presence stanzas it sends with elements containing a presence-session element with namespace "urn:xmpp:presence-session:0", a "session" attribute and an "id" attribute, described below.

Example 2. Romeo receives an occupant's presence
  <x xmlns='http://jabber.org/protocol/muc#user'>
    <item affiliation='owner' role='moderator'/>
  <presence-session xmlns="urn:xmpp:presence-session:0" session="u8e8t2thu" id="893oehh"/>


4.2 Fast rejoin

If Romeo then leaves the room and wants to rejoin, his client can attempt a fast rejoin. To request only the presence changes since he was last an occupant, it includes a presence-session element in his room join stanza, again with namespace "urn:xmpp:presence-session:0", with a type attribute whose value is "resume" and the session and id attributes of the last presence it received from the room prior to leaving. This corresponds to the "last known state".

Example 3. Romeo performs a fast rejoin on the room
  <x xmlns='http://jabber.org/protocol/muc'/>
  <presence-session xmlns="urn:xmpp:presence-session:0" session="u8e8t2thu" id="893oehh" type="resume"/>

When the MUC room receives a room fast rejoin request, it MUST either satisfy the request by sending incremental updates to the room state or send a complete set of stanzas to reestablish the current state.

If the room is able to update the client's state incrementally, it SHOULD only send those presence stanzas needed by the client to remove any occupants no longer in the room, add any newly joined occupants and update the state of any occupants whose status has changed (either because they have changed their presence sent to the room (e.g. changed to an 'away' state) or because their status within the MUC has changed (e.g. they have become a moderator). If the incremental stanzas would present a greater volume of data than a fresh join, it is RECOMMENDED that the server sends fresh join information instead.

If the server is unable to calculate the stanzas required to send the client an incremental update (or if it is to send a fresh join for some other reason), it MUST first send an 'unavailable' presence from the room's bare JID, followed by a normal full join, as above

All the presence stanzas (apart from the initial unavailable presence used to reset state before a clean join) MUST contain the presence-session element as described above.

Example 4. Romeo receives an 'unavailable' presence from the room, indicating that it is a clean join.

The room SHOULD only send the unavailable presence, forcing a sending of all the occupants' presence, if it would either result in fewer transmitted stanzas than sending the necessary delta, or it is unable to provide the necessary delta (such as if too much time has past and it no longer has records of the old state).

4.3 Receiving only unseen messages

XEP-0045 provides several ways to limit the history/context messages received on join, but none of these allow a client to accurately request only the messages they have yet to see. To address this, the MUC service annotates each message with an id (in the same manner as presence, above), and the room will consider only messages since the last stanza the client received when applying the default/maxchars/maxstanzas/seconds/since rules from -45 for sending context. If the room doesn't send the full history of messages that the client has yet to receive (e.g. due to the application of history controls or because the server hasn't stored them) it sends a message to the client such the client knows it only has partial history.

Some informal examples:

Example 5. Romeo receives annotated message while in room
  <body>Ay me!</body>
  <presence-session xmlns="urn:xmpp:presence-session:0" session="u8e8t2thu" id="893ou22"/>

When sending broadcast messages from the room, the service MUST annotate them with a presence-session stanza with xmlns "urn:xmpp:presence-session:0" and session and id attributes as defined above for presence stanzas.

Example 6. Room informs Romeo's client that it will not transmit the full missing history
  <presence-session xmlns="urn:xmpp:presence-session:0" type="truncated"/>

When the room does not send the full history of all messages that the client has not received, it MUST (prior to sending any history and subsequent to sending presence) send a message stanza with a payload whose name is 'presence-session' and namespace is "urn:xmpp:presence-session:0" with an attribute named "type" whose value is "truncated". This lets the client know that it is missing history and it could choose to display this to the user in some way.

5. Security Considerations

This specification doesn't add additional security considerations beyond those of its dependencies..

6. IANA Considerations


7. XMPP Registrar Considerations

Needs a namespace.

8. XML Schema

When advanced.


Appendix A: Document Information

XMPP Standards Foundation
Standards Track
Last Updated
Approving Body
XMPP Council
XMPP Core, XMPP IM, XEP-0045
Superseded By
Short Name
Source Control

This document in other formats: XML  PDF

Appendix B: Author Information

Kevin Smith


This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).


Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) 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.

Appendix E: Discussion Venue

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 <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

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

Appendix G: Notes

1. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.1 (2012-01-25)

    Version approved for publication by the XMPP Council.

  2. Version 0.0.1 (2012-01-05)

    First draft.


Appendix I: Bib(La)TeX Entry

  title = {MUC Fast Reconnect},
  author = {Smith, Kevin},
  type = {XEP},
  number = {0311},
  version = {0.1},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0311.html},
  date = {2012-01-05/2012-01-25},