JEP-0085: Chat State Notifications

A standards-track proposal for communicating notifications related to chat states, including message composing events.


WARNING: Consideration of this JEP has been Deferred by the Jabber Software Foundation. Implementation of the protocol described herein is not recommended.


JEP Information

Status: Deferred
Type: Standards Track
Number: 0085
Version: 0.6
Last Updated: 2004-02-19
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core, XMPP IM
Supersedes: None
Superseded By: None
Short Name: chatstates

Author Information

Dave Smith

Email: dizzyd@jabber.org
JID: dizzyd@jabber.org

Peter Saint-Andre

Email: stpeter@jabber.org
JID: stpeter@jabber.org

Legal Notice

This Jabber Enhancement Proposal is copyright 1999 - 2004 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.php>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <http://www.opencontent.org/openpub/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core and XMPP IM specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocols defined in this JEP have been developed outside the Internet Standards Process and are to be understood as extensions to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.


Table of Contents

1. Introduction
2. Definitions
3. State Chart
4. Business Rules
4.1. Discovery of Support and Generation of Notifications
4.2. Support Requirements
4.3. Context of Usage
4.4. Use in Groupchat
4.5. Syntax of Notifications
4.6. Threads
4.7. Server Handling of Notifications
5. A Simple Example
6. A Detailed Conversation
7. Security Considerations
8. IANA Considerations
9. Jabber Registrar Considerations
10. XML Schema
Notes
Revision History


1. Introduction

The Message Events [1] protocol was an early attempt to define notifications related to message processing and composing events. However, it is informational only and has the following drawbacks:

  1. Message events are used both to communicate the state of one's conversation partner (the composing event) and to track message delivery states (the offline storage, delivery, and display events); this is confusing, especially since message delivery states are now more fully defined by Advanced Message Processing [2], which in part supersedes message events.
  2. Message events can be generated either by a client or by a server, and the sender must depend on the recipient's server in order to receive notification of certain events; this introduces an unnecessary dependency.
  3. Message events must be requested on a per-message basis; this is not only verbose but unnecessary in the context of most chat conversations, and requires implementations to maintain a more complex state machine than is desirable.
  4. The connection between the 'id' attribute and the <id/> element has traditionally been difficult for developers to understand; this has led to a large number of non-compliant implementations.
  5. The necessity for cancelling previously-generated composing events is introduced because the protocol does not define a complete state chart for chat conversations; this is not only incomplete but confusing.

This proposal attempts to address those concerns and to provide a protocol that can be accepted as a standard by the Jabber Software Foundation.

2. Definitions

This proposal supplements the traditional "is-composing" state by defining four additional chat states, for a total of five states that together fully describe the possible states for a chat conversation. These states refer to a user's participation in the chat session, not necessarily to the state of the client interface and certainly not to the disposition of a particular message. However, the user's involvement with the system, device, chat interface, or input interface can provide important clues regarding the user's involvement with the chat session, which should be used by the client in determining when to generate chat state notifications.

In essence, chat state notifications can be thought of as a form of chat-specific presence. For example, consider what might happen if a user "loses" a chat window on his desktop; the user might still be interacting with his messaging client (thus never automatically changing to "away"), but the user's state with regard to the chat might change progressively from active to inactive to gone. This information would help the user's conversation partner understand why she has not received a response to her messages in the chat session.

The five chat states addressed in this document are described below. The suggested triggers are simply that: suggestions. It is up to the implementation to determine its own rules for generation of chat state notifications.

Table 1: Chat States

State Definition Suggested Triggers
ACTIVE User is participating in the chat session User accepts initial chat message, sends a message, or is otherwise paying attention to the chat interface
COMPOSING User is currently composing a message User interaction with the input interface specific to this chat session (e.g., typing in an input area)
PAUSED User had been composing but now has stopped Lack of user interaction with the input interface for a short period (e.g., 15 seconds)
INACTIVE User is not actively participating in the chat session Lack of user interaction with the chat interface for a longer period (e.g., 2 minutes)
GONE User has ended their participation in the chat session Lack of user interaction with the chat interface, system, or device for a long period (e.g., 10 minutes)

3. State Chart

The following figure attempts to capture the possible state transitions in visual form (all four of the states shown may transition to GONE).


                o (start)
                |
                |
INACTIVE <--> ACTIVE <--> COMPOSING 
    |           ^            |
    |           |            |
    + <------ PAUSED <-----> +

  

4. Business Rules

4.1 Discovery of Support and Generation of Notifications

  1. A User MUST NOT notify a Contact of any chat state other than Active until the User has discovered that the Contact supports this protocol (the same is true of the Contact).
  2. If the User desires chat state notifications, the initial message MUST contain an Active notification.
  3. The Contact MUST NOT send any chat state notifications to the User (e.g., a composing event) before sending a reply to the User's initial message in the conversation; the only allowable chat state notification in the initial reply is the Active notification.
  4. If the Contact replies to the initial message but does not include an Active notification, the User MUST NOT send subsequent chat state notifications to the Contact.
  5. If the Contact replies to the initial message and includes an Active notification, the Contact SHOULD send subsequent notifications for supported chat states as specified in the next subsection.

4.2 Support Requirements

Table 2: Requirements for Supporting Each Chat State

Chat State Requirement
Active MUST
Composing MUST
Paused SHOULD
Inactive SHOULD
Gone SHOULD

A client MUST allow the user to configure whether he or she wants to send chat state notifications.

4.3 Context of Usage

  1. This protocol MUST NOT be used with stanzas other than <message/>.
  2. This protocol SHOULD NOT be used with message types other than "chat" or "groupchat".
  3. The 'type' attribute for chat state notification messages SHOULD be set to a value of "chat" or "groupchat" (as appropriate for the context).
  4. A chat session MAY span multiple user sessions (i.e., chat state is orthogonal to the availability and presence of one's conversation partner).

4.4 Use in Groupchat

  1. In the context of groupchat (e.g., as defined in Multi-User Chat [3]), a client SHOULD NOT generate Gone notifications, and SHOULD ignore Gone notifications received from other room occupants.

NOTE: use of chat state notifications in the context of groupchat may result in multicasting of such notifications. Forewarned is forearmed.

4.5 Syntax of Notifications

  1. Chat state notification messages MUST contain one and only one element qualified by the 'http://jabber.org/protocol/chatstates' namespace.
  2. A Composing notification message MUST NOT contain a <subject/> element or a <body/> element (i.e., it MUST be "standalone").

4.6 Threads

While chat state notifications provide a mechanism for managing chat threads (i.e., the <thread/> element), support for threads is OPTIONAL. However, if threads are used, the following additional business rules apply:

  1. Clients MUST copy back Thread IDs (i.e., the value of the <thread/> element) in any replies.
  2. When a client terminates a one-to-one chat session (e.g., when a user closes the chat session interface), it MUST generate a Gone event.
  3. Upon receiving a Gone event, a client MUST NOT re-use the same Thread ID and MUST generate a new Thread ID for any subsequent chat messages sent to the conversation partner.

4.7 Server Handling of Notifications

Servers and services that handle or rebroadcast message stanzas may want to process chat state notification messages differently from other messages. In particular, a server or service MAY refuse to deliver standalone chat state notifications to its users, and SHOULD NOT store them offline. In contrast to the Message Events protocol, chat state notifications are completely the responsibility of the client, and MUST NOT be generated by a server or service.

5. A Simple Example

In the following conversation, both User and Contact support chat state notifications.

Example 1. User Sends Initial Message With Active Notification

<message 
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit'
    type='chat'>
  <body>Who's there?</body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Example 2. Contact's Client Sends Reply Plus Active Notification

<message 
    from='francisco@shakespeare.lit/elsinore'
    to='bernardo@shakespeare.lit/pda'
    type='chat'>
  <body>Nay, answer me: stand, and unfold yourself.</body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Because the User now knows that the Contact supports chat state notifications, the User can send other notification types.

Example 3. User Sends Composing Notification

<message 
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit/elsinore'
    type='chat'>
  <composing xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Example 4. User Sends a Reply With Active Notification

<message 
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit/elsinore'
    type='chat'>
  <body>Long live the king!</body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

And so forth.

6. A Detailed Conversation

The following conversation flow illustrates in more detail the workings of chat state notifications (in this case also using threads).

Example 5. User Sends Initial Message

<message 
    from='romeo@shakespeare.lit/orchard'
    to='juliet@capulet.com'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <body>
    I take thee at thy word:
    Call me but love, and I'll be new baptized;
    Henceforth I never will be Romeo.
  </body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

At this point the Contact's client knows that the User's client supports chat state notifications. Thus the Contact replies to the initial message, including a notification that the Contact's state is Active:

Example 6. Contact's Client Sends Reply Plus Active Notification

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <body>
    What man art thou that thus bescreen'd in night
    So stumblest on my counsel?
  </body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

After a while, Juliet asks a question that brings Romeo up short. Romeo begins composing a reply to Juliet's heartfelt question, and his Jabber client notifies Juliet that he is composing a reply.

Example 7. User's Client Sends Composing Notification

<message 
    from='romeo@montague.net/orchard' 
    to='juliet@capulet.com/balcony'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <composing xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Romeo realizes his reply is too rash and pauses to choose the right words; after some (configurable) time period, his Jabber client senses the delay and sends a state of Paused.

Example 8. User's Client Sends Active Notification

<message 
    from='romeo@montague.net/orchard' 
    to='juliet@capulet.com/balcony'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <paused xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Romeo starts composing again, and his Jabber client sends a Composing notification to Juliet's client.

Example 9. User's Clients Sends Composing Notification

<message 
    from='romeo@montague.net/orchard' 
    to='juliet@capulet.com/balcony'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <composing xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Romeo finally sends his reply.

Example 10. User Replies

<message 
    from='romeo@montague.net/orchard' 
    to='juliet@capulet.com/balcony'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <body>Neither, fair saint, if either thee dislike.</body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

The conversation ebbs and flows, waxes and wanes, until Juliet is called away by her Nurse...

Example 11. Contact's Client Sends Message

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <body>
    I hear some noise within; dear love, adieu!
    Anon, good nurse! Sweet Montague, be true.
    Stay but a little, I will come again.
  </body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Because Juliet is away from the chat interface for a while, her client (optionally) generates an Inactive notification:

Example 12. Contact's Client Sends Inactive Notification

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <inactive xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

When she returns and brings the window up again, her client generates an Active notification:

Example 13. Contact's Client Sends Active Notification

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

The conversation continues, but Juliet is called away again by that nagging Nurse:

Example 14. Contact's Client Sends Message

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <body>
    A thousand times good night!
  </body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

Now Juliet is away from the chat window for a longer time, and her client generates a Gone notification:

Example 15. Contact's Client Sends Gone Notification

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat1</thread>
  <gone xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

The User's client now considers the chat thread to be over and generates a new thread:

Example 16. User's Client Sends Message with New Thread ID

<message 
    from='romeo@shakespeare.lit/orchard'
    to='juliet@capulet.com/balcony'
    type='chat'>
  <thread>act2scene2chat2</thread>
  <body>
    A thousand times the worse, to want thy light.
    Love goes toward love, as schoolboys from their books,
    But love from love, toward school with heavy looks.
  </body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

When Juliet returns to her computer on the balcony, she finds the new message from Romeo. When she finishes her reply, her client includes both an Active notification and the new Thread ID with the body of her reply:

Example 17. Contact's Client Sends Message

<message 
    from='juliet@capulet.com/balcony'
    to='romeo@shakespeare.lit/orchard'
    type='chat'>
  <thread>act2scene2chat2</thread>
  <body>
    Hist! Romeo, hist! O, for a falconer's voice,....
  </body>
  <active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
  

And so forth.

My, these star-crossed lovers do go on, don't they?

7. Security Considerations

The states of a chat thread may reveal information about a user's interaction with his or her computer, including his or her physical presence; such information SHOULD NOT be revealed to conversation partners who are not trusted to know such information. Client implementations MUST provide a mechanism that enables the user to disable chat state notifications if desired.

8. IANA Considerations

This JEP requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].

9. Jabber Registrar Considerations

The 'http://jabber.org/protocol/chatstates' namespace shall be registered with the Jabber Registrar [5] as a result of this JEP.

10. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/chatstates'
    xmlns='http://jabber.org/protocol/chatstates'
    elementFormDefault='qualified'>

  <xs:element name='active' type='empty'/>
  <xs:element name='composing' type='empty'/>
  <xs:element name='gone' type='empty'/>
  <xs:element name='inactive' type='empty'/>
  <xs:element name='paused' type='empty'/>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
  


Notes

1. JEP-0022: Message Events <http://www.jabber.org/jeps/jep-0022.html>.

2. JEP-0079: Advanced Message Processing <http://www.jabber.org/jeps/jep-0079.html>.

3. JEP-0045: Multi-User Chat <http://www.jabber.org/jeps/jep-0045.html>.

4. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

5. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.


Revision History

Version 0.6 (2004-02-19)

Added Paused state; defined the chat states; clarified the state chart; simplified the business rules. (psa)

Version 0.5 (2003-09-18)

Clarified that 'type' must be "chat" or "groupchat" for chat state notification messages. (psa)

Version 0.4 (2003-05-22)

Made Thread IDs optional; made Inactive and Gone states optional if Thread IDs are not used; removed requirement for explicit service discovery in favor of implicit discovery. (psa)

Version 0.3 (2003-05-20)

Clarified terminology; added support for groupchat; added several implementation notes. (psa)

Version 0.2 (2003-05-19)

General cleanup; added schema. (psa)

Version 0.1 (2003-05-19)

Initial version. (dss/psa)


END