%ents; ]>
Chat State Notifications This document defines an XMPP protocol extension for communicating the status of a user in a chat session, thus indicating whether a chat partner is actively engaged in the chat, composing a message, temporarily paused, inactive, or gone. The protocol can be used in the context of a one-to-one chat session or a multi-user chat room. &LEGALNOTICE; 0085 Final Standards Track Standards XMPP Core XMPP IM XEP-0030 XEP-0022 chatstates http://www.xmpp.org/schemas/chatstates.xsd &stpeter; &dizzyd; 2.1 2009-09-23 psa

Clarified that any state change is allowed.

2.0 2008-11-26 psa

Per a vote of the XMPP Council, advanced specification to Final; clarified the implicit discovery mechanism.

1.2 2006-07-12 psa

Added service discovery use case.

1.1 2005-10-05 psa

Clarified suggested triggers to discourage prospective notifications.

1.0 2005-08-26 psa

Per a vote of the Jabber Council, advanced status to Draft.

0.14 2005-07-20 psa

Clarified terminology; specified suggested state changes; removed section on superseding XEP-0022.

0.13 2005-07-19 psa

Further clarified business rules regarding generation of notifications.

0.12 2005-07-15 psa

Clarified business rules regarding generation of notifications; added reference to XEP-0155; rewrote introduction; moved previous introductory text to section on superseding XEP-0022.

0.11 2005-07-05 psa

Removed <initial/> state.

0.10 2005-06-28 psa

Added optional <initial/> state; added business rule on repetition of notifications; added implementation note.

0.9 2004-10-28 psa

Made <inactive/> state definition consistent with <paused/> per list discussion; made slight adjustments to wording throughout.

0.8 2004-10-28 psa

Further clarified state definitions and adjusted suggested event timing.

0.7 2004-10-27 psa

Clarified the meaning of the <gone/> state; adjusted suggested timing for events.

0.6 2004-02-19 psa

Added <paused/> state; defined the chat states; clarified the state chart; simplified the business rules.

0.5 2003-09-18 psa

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

0.4 2003-05-22 psa

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.

0.3 2003-05-20 psa

Clarified terminology; added support for groupchat; added several implementation notes.

0.2 2003-05-19 psa

General cleanup; added schema.

0.1 2003-05-19 dss/psa

Initial version.

Many instant messaging systems include notifications about the state of one's conversation partner in a one-to-one chat (or, sometimes, in a many-to-many chat). Usually these are limited to notification that one's partner is currently typing -- e.g., the Composing event in the older (deprecated) &xep0022; protocol. However, a composing event is essentially information about a person's participation in or involvement with the chat "session" and therefore is really a session-level state rather than a per-message event (in contrast to the Delivered and Displayed events in XEP-0022). While the composing event is interesting, the concept of a session-level state can be extended to answer a variety of questions about the participation of a person in a real-time chat conversation, such as:

To answer such questions, this document supplements the traditional composing state by defining four additional chat states (paused, active, inactive, gone), for a total of five states that (it is hoped) together fully describe the possible states of a person's participation in or involvement with a chat conversation. These states do not necessarily refer 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 session interface, or input interface can provide important clues regarding the user's involvement with the chat session; these clues can 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 his basic presence to "away"), but the user's state with regard to the chat session 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.

Chat state notifications can appear in two kinds of &MESSAGE; stanzas:

The five chat states specified in this document are described below. The suggested triggers are simply that: suggestions. It is up to the implementation to determine when to generate chat state notifications and which notifications to generate.

State Definition Suggested Triggers
<active/> User is actively participating in the chat session. User accepts an initial content message, sends a content message, gives focus to the chat session interface (perhaps after being inactive), or is otherwise paying attention to the conversation.
<inactive/> User has not been actively participating in the chat session. User has not interacted with the chat session interface for an intermediate period of time (e.g., 2 minutes).
<gone/> User has effectively ended their participation in the chat session. User has not interacted with the chat session interface, system, or device for a relatively long period of time (e.g., 10 minutes).
<composing/> User is composing a message. User is actively interacting with a message input interface specific to this chat session (e.g., by typing in the input area of a chat window).
<paused/> User had been composing but now has stopped. User was composing but has not interacted with the message input interface for a short period of time (e.g., 30 seconds).

Note that the <active/>, <inactive/>, and <gone/> states refer to the overall chat session interface whereas the <composing/> and <paused/> states refer to the message input interface (and are in some sense a subset of <active/>). Some implementations might support only events related to the message input interface, some implementations might support only events related to the overall chat session interface, and some implementations might support both kinds of events.

The following figure attempts to capture the most common state transitions in visual form (all four of the states shown can also transition to the GONE state).

ACTIVE <--> COMPOSING <--> PAUSED | | | | +---<---<---<---<---<---<---<---<---<---+ ]]>

Note: Other transitions are not forbidden if the developers of an implementation feel that such transitions are desirable (e.g., INACTIVE to PAUSED if a user returns to a chat session interface containing an unfinished message).

If an entity supports the Chat State Notifications protocol, it MUST advertise that fact in its responses to &xep0030; information ("disco#info") requests by returning a feature of "http://jabber.org/protocol/chatstates":

]]> ]]>

In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.

Before generating chat state notifications, a User SHOULD explicitly discover whether the Contact supports the protocol defined herein (as described in the Discovering Support section of this document) or explicitly negotiate the use of chat state notifications with the Contact (e.g., via &xep0155;).

In the absence of explicit discovery or negotiation, the User MAY implicitly request and discover the use of chat state notifications in a one-to-one chat session by adhering to the following business rules:

  1. If the User desires chat state notifications, the message(s) that it sends to the Contact before receiving a reply MUST contain a chat state notification extension, which SHOULD be <active/>.
  2. If the Contact replies but does not include a chat state notification extension, the User MUST NOT send subsequent chat state notifications to the Contact.
  3. If the Contact replies and includes an <active/> notification (or sends a standalone notification to the User), the User and Contact SHOULD send subsequent notifications for supported chat states (as specified in the next subsection) by including an <active/> notification in each content message and sending standalone notifications for the chat states they support (at a minimum, the <composing/> state).

The foregoing rules imply that the sending of chat state notifications is bidirectional (i.e., both User and Contact will either send or not send chat state notifications) rather than unidirectional (i.e., one of the conversation partners will send chat state notifications but the other will not); this is by design.

Chat State Requirement
<active/> MUST
<composing/> MUST
<paused/> SHOULD
<inactive/> SHOULD
<gone/> SHOULD

A client MUST allow users to configure whether they want to send chat state notifications.

Note: Support for only <active/> and <composing/> is functionally equivalent to supporting the Composing event from XEP-0022.

Even if the user types continuously for a long time (e.g., while composing a lengthy reply), the client MUST NOT send more than one standalone <composing/> notification in a row. More generally, a client MUST NOT send a second instance of any given standalone notification (i.e., a standalone notification MUST be followed by a different state, not repetition of the same state). However, every content message SHOULD contain an <active/> notification.

  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 content messages and standalone notifications SHOULD be set to a value of "chat" (for one-to-one sessions) or "groupchat" (for many-to-many sessions).
  4. A chat session MAY span multiple user sessions (i.e., chat state is orthogonal to the presence of one's conversation partner), although this is unlikely given the suggested timing of event triggers.

Chat state notifications MAY be sent in the context of groupchat rooms (e.g., as defined in &xep0045;). The following business rules apply:

  1. A client MAY send chat state notifications even if not all room occupants do so.
  2. A client SHOULD NOT generate <gone/> notifications.
  3. A client SHOULD ignore <gone/> notifications received from other room occupants.

Note: Use of chat state notifications in the context of groupchat can result in multicasting of such notifications. Forewarned is forearmed.

  1. A message stanza MUST NOT contain more than one child element qualified by the 'http://jabber.org/protocol/chatstates' namespace.
  2. A message stanza that contains standard instant messaging content SHOULD NOT contain a chat state notification extension other than <active/>, where "standard instant messaging content" is taken to mean the <body/>, <subject/>, and <thread/> child elements defined in &xmppim; or any other child element that would lead the recipient to treat the stanza as an instant message as explained in &xep0226;.
  3. A message stanza that does not contain standard messaging content and is intended to specify only the chat state MUST NOT contain any child elements other than the chat state notification extension, which SHOULD be a state other than <active/>; however, if threads are used (see below) then the standalone notification MUST also contain the <thread/> element.

While chat state notifications provide a mechanism for managing chat threads as communicated by inclusion of the XMPP <thread/> element, support for threads is OPTIONAL (for further information about threads, refer to &xep0201;). However, if all of the clients participating in a chat both support and use threads, 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.

Servers in constrained network environments (e.g., serving small-footprint clients via &xep0025; or &xep0124;) and services that rebroadcast message stanzas (e.g., Multi-User Chat services) MAY process standalone notifications differently from other messages. In particular, a server or service MAY refuse to deliver standalone notifications to its users, and SHOULD NOT store them offline. In contrast to XEP-0022, chat state notifications are completely the responsibility of the client, and MUST NOT be generated by a server or service.

In the following conversation, both User <bernardo@shakespeare.lit> and Contact <francisco@shakespeare.lit> support chat state notifications.

Who's there? ]]> Nay, answer me: stand, and unfold yourself. ]]>

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

]]> Long live the king! ]]>

And so forth.

The following conversation flow illustrates in more detail the workings of chat state notifications (in this case also using threads) between a User <romeo@shakespeare.lit> and a Contact <juliet@capulet.com>.

act2scene2chat1 I take thee at thy word: Call me but love, and I'll be new baptized; Henceforth I never will be Romeo. ]]>

At this point Juliet's client knows that Romeo's client supports chat state notifications. Thus she replies to the content message and her client includes a notification that her state is <active/>:

act2scene2chat1 What man art thou that thus bescreen'd in night So stumblest on my counsel? ]]>

And so the conversation continues. After a while, Juliet asks a question that brings Romeo up short:

act2scene2chat1 Art thou not Romeo, and a Montague? ]]>

Romeo begins composing a reply to Juliet's heartfelt question, and his client notifies Juliet that he is composing a reply.

act2scene2chat1 ]]>

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

act2scene2chat1 ]]>

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

act2scene2chat1 ]]>

Romeo finally sends his reply.

act2scene2chat1 Neither, fair saint, if either thee dislike. ]]>

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

act2scene2chat1 I hear some noise within; dear love, adieu! Anon, good nurse! Sweet Montague, be true. Stay but a little, I will come again. ]]>

We suppose that Juliet minimizes the chat window, so her client generates an <inactive/> notification:

act2scene2chat1 ]]>

When she returns and brings the window up again, her client generates an <active/> notification:

act2scene2chat1 ]]>

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

act2scene2chat1 A thousand times good night! ]]>

We suppose that Juliet closes the chat window, so her client generates a <gone/> notification:

act2scene2chat1 ]]>

Romeo's client now considers the chat thread to be over and generates a new Thread ID when he sends a new message:

act2scene2chat2 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. ]]>

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:

act2scene2chat2 Hist! Romeo, hist! O, for a falconer's voice,.... ]]>

And so forth.

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

A client that receives a chat state notification might never receive another message or chat state notification from the other entity (e.g., because the other entity crashes or goes offline) and needs to plan accordingly.

The states of a chat thread can 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.

This document requires no interaction with &IANA;.

The ®ISTRAR; includes 'http://jabber.org/protocol/chatstates' in its registry of protocol namespaces.

The protocol documented by this schema is defined in XEP-0085: http://www.xmpp.org/extensions/xep-0085.html ]]>