There are some contexts in which you want to be able to rate limit Multi-User Chat (XEP-0045) [1] messages. This could have multiple motivations: avoid flooding, garantee a better readability of the room when there are hundreds of active users, …
This specification propose a new option to MUC rooms, allowing room owners to fix a duration that users MUST wait between two messages. We will also specify how the server MUST reject messages send too quickly, and how clients SHOULD handle this feature (by preventing users to send messages without waiting the delay to be over, and displaying some information to them).
This document addresses the following requirements:
Many terms used in this XEP are defined in Multi-User Chat (XEP-0045) [1] and Service Discovery Extensions (XEP-0128) [2]. Please refer to these XEP for more informations.
The MUC Slow Mode can for example be used when a MUC room is associated to a live video stream. In such case, there are often hundreds of people writing at the same time. To avoid flooding, and encourage participants to post relevant messages, slow mode can be usefull.
Your implementation MAY allow the Slow Mode feature to be set room by room, by their owners.
If room owners can configure the Slow Mode feature, the server MUST add a
'muc#roomconfig_slow_mode_duration'
field in the room
configuration form.
This field MUST have its type equal to 'text-single'
.
This field MUST use
Data Forms Validation
, having its datatype equal to 'xs:integer'
.
The 'value'
of the field MUST be a positive integer, so you MUST
add a 'range'
validation, as described in Data Forms Validation (XEP-0122) [3].
Value '0'
means that the slow mode is disabled for this room.
Any positive value is the duration, in seconds, users must wait between two messages.
Here is an example of response the server could send when a client is querying room configuration form:
If the configuration is changed, the server SHOULD send a status code
'104'
, as specified in
XEP-0045 - Notification of configuration changes
.
The feature can be enabled on a room:
In other words: you can enable this feature, without adding the field in the room configuration form. This allows for example server admins to apply a rate limit server-wide, or to set the slow mode programmatically on any wanted criteria (number of users in the room, current server load, room context, ...).
In any case, to allow clients to discover that the feature is active, the
server MUST respond on
room information queries
by adding a 'muc#roominfo_slow_mode_duration'
field.
This field type MUST be 'text-single'
, and its value MUST be a
positive integer.
Value '0'
means that the slow mode is disabled for this room.
Any positive value is the duration, in seconds, users must wait between two messages.
Any invalid (non-positive integer) value sent by the server MUST be
considered as equal to '0'
(in case of a bad implementation).
Here is an example of response the server could send when a client is querying room information:
If the slow mode duration has changed (either because the room configuration
was modified, or because a server parameter has changed, or any other
reason), the server SHOULD send a status code '104'
, as specified
in
XEP-0045 - Notification of configuration changes.
When the Slow Mode is enabled, server MUST NOT accept two consecutive messages from the same user, to the same room, until the slow mode duration has elapsed.
Only messages containing at least one '<body/>'
element must
be taking into account (to avoid counting 'chatstate'
messages for
example).
Room administrators and owners MUST NOT be rate limited.
If a user bypass the limit, the server MUST reply an error stanza, that respects RFC 6120 [4] stanza erors (see RFC6120 - stanza errors), to reject the message. Especially:
'error_type'
MUST be 'wait'
, as described in
RFC6120 - Stanzas error - Syntax
.
'error_condition'
MUST be 'policy-violation'
, as
described in
RFC 6120 - Stanzas error - Defined Stream Error Conditions,
<text>'
element explaining why
the message was rejected, and this message SHOULD mention the slow mode
duration so that users can understand why they can't post their message.
Here is an example or error stanza:
The rejected message MUST NOT be forwarded to other room occupants.
When a participant joins a room, the client SHOULD request room information
as described in section
"Client discovering", and look for the
'muc#roominfo_slow_mode_duration'
field.
If this field is present, and contains a valid strictly positive integer value, the client SHOULD display an information somewhere, to tell users that there is a slow mode limitation that applies to this room. This information MAY also be displayed to users for which the rate limit does not apply (administrators, owners, ...).
Moreover, each time a participant sends a text message, the client SHOULD prevent the user to send another message before the timeout is passed. This MAY be done either by disabling the input field, or the submit button. If the user has at least the administrator acces level, the client SHOULD NOT disable the input field or the submit button.
To avoid some frustrating behaviour, in case there is some lag on the server for example, the client MAY start counting time after receiving the message echo. Indeed, if the first message is processed with some delay by the server, it could consider that the duration is not passed yet when receiving the next one.
As a same user can join a room with multiple sessions and/or nicknames, the server MUST use the appropriate criteria to identify the account, and apply the same limits to all user's sessions.
The slow mode duration parameter is a positive integer. When parsing its value, clients and servers MUST ignore invalid value. They MUST also check that this value is not to big to store in memory (this depends on the data type used by the implementation).
This document requires no interaction with the Internet Assigned Numbers Authority (IANA).
Field Standardization for Data Forms (XEP-0068) [5] defines a process for standardizing the fields used within Data Forms scoped by a particular namespace, and the XMPP Registrar maintains a registry of such FORM_TYPES (see <https://xmpp.org/registrar/formtypes.html>). In this XEP there are two uses of such form fields:
'muc#roomconfig_slow_mode_duration'
field.
'muc#roominfo_slow_mode_duration'
field.
The registry submissions associated with these namespaces are defined below.
The registrar shall add the following field to the 'muc#roomconfig' data form:
The registrar shall add the following field to the 'muc#roominfo' data form:
This document in other formats: XML PDF
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.
## 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. ##
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.
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).
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.
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.
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.
Given that this XMPP Extension Protocol normatively references IETF technologies, discussion on the <xsf-ietf@xmpp.org> list might also be appropriate.
Errata can be sent to <editor@xmpp.org>.
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".
1. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.
2. XEP-0128: Service Discovery Extensions <https://xmpp.org/extensions/xep-0128.html>.
3. XEP-0122: Data Forms Validation <https://xmpp.org/extensions/xep-0122.html>.
4. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.
5. XEP-0068: Field Data Standardization for Data Forms <https://xmpp.org/extensions/xep-0068.html>.
Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/
Include first feedbacks
Promoted to Experimental
First draft.
@report{livingston2024muc-slow-mode, title = {MUC Slow Mode}, author = {Livingston, John}, type = {XEP}, number = {0500}, version = {0.1.1}, institution = {XMPP Standards Foundation}, url = {https://xmpp.org/extensions/xep-0500.html}, date = {2024-02-28/2024-12-03}, }
END