1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-11 18:32:16 -05:00
xeps/xep-0085.xml

571 lines
30 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Chat State Notifications</title>
<abstract>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.</abstract>
&LEGALNOTICE;
<number>0085</number>
<status>Final</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
<spec>XMPP IM</spec>
<spec>XEP-0030</spec>
</dependencies>
<supersedes>
<spec>XEP-0022</spec>
</supersedes>
<supersededby/>
<shortname>chatstates</shortname>
<schemaloc>
<url>http://www.xmpp.org/schemas/chatstates.xsd</url>
</schemaloc>
&stpeter;
&dizzyd;
<revision>
<version>2.1</version>
<date>2009-09-23</date>
<initials>psa</initials>
<remark><p>Clarified that any state change is allowed.</p></remark>
</revision>
<revision>
<version>2.0</version>
<date>2008-11-26</date>
<initials>psa</initials>
<remark><p>Per a vote of the XMPP Council, advanced specification to Final; clarified the implicit discovery mechanism.</p></remark>
</revision>
<revision>
<version>1.2</version>
<date>2006-07-12</date>
<initials>psa</initials>
<remark><p>Added service discovery use case.</p></remark>
</revision>
<revision>
<version>1.1</version>
<date>2005-10-05</date>
<initials>psa</initials>
<remark><p>Clarified suggested triggers to discourage prospective notifications.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2005-08-26</date>
<initials>psa</initials>
<remark><p>Per a vote of the Jabber Council, advanced status to Draft.</p></remark>
</revision>
<revision>
<version>0.14</version>
<date>2005-07-20</date>
<initials>psa</initials>
<remark><p>Clarified terminology; specified suggested state changes; removed section on superseding XEP-0022.</p></remark>
</revision>
<revision>
<version>0.13</version>
<date>2005-07-19</date>
<initials>psa</initials>
<remark><p>Further clarified business rules regarding generation of notifications.</p></remark>
</revision>
<revision>
<version>0.12</version>
<date>2005-07-15</date>
<initials>psa</initials>
<remark><p>Clarified business rules regarding generation of notifications; added reference to XEP-0155; rewrote introduction; moved previous introductory text to section on superseding XEP-0022.</p></remark>
</revision>
<revision>
<version>0.11</version>
<date>2005-07-05</date>
<initials>psa</initials>
<remark><p>Removed &lt;initial/&gt; state.</p></remark>
</revision>
<revision>
<version>0.10</version>
<date>2005-06-28</date>
<initials>psa</initials>
<remark><p>Added optional &lt;initial/&gt; state; added business rule on repetition of notifications; added implementation note.</p></remark>
</revision>
<revision>
<version>0.9</version>
<date>2004-10-28</date>
<initials>psa</initials>
<remark><p>Made &lt;inactive/&gt; state definition consistent with &lt;paused/&gt; per list discussion; made slight adjustments to wording throughout.</p></remark>
</revision>
<revision>
<version>0.8</version>
<date>2004-10-28</date>
<initials>psa</initials>
<remark><p>Further clarified state definitions and adjusted suggested event timing.</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2004-10-27</date>
<initials>psa</initials>
<remark><p>Clarified the meaning of the &lt;gone/&gt; state; adjusted suggested timing for events.</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2004-02-19</date>
<initials>psa</initials>
<remark><p>Added &lt;paused/&gt; state; defined the chat states; clarified the state chart; simplified the business rules.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2003-09-18</date>
<initials>psa</initials>
<remark><p>Clarified that 'type' must be "chat" or "groupchat" for chat state notification messages.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2003-05-22</date>
<initials>psa</initials>
<remark><p>Made Thread IDs optional; made &lt;inactive/&gt; and &lt;gone/&gt; states optional if Thread IDs are not used; removed requirement for explicit service discovery in favor of implicit discovery.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2003-05-20</date>
<initials>psa</initials>
<remark><p>Clarified terminology; added support for groupchat; added several implementation notes.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2003-05-19</date>
<initials>psa</initials>
<remark><p>General cleanup; added schema.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2003-05-19</date>
<initials>dss/psa</initials>
<remark><p>Initial version.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>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 <cite>XEP-0022</cite>). 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:</p>
<ul>
<li>Has this person paused the composition?</li>
<li>Is this person actively paying attention to the chat?</li>
<li>Is this person temporarily inactive (i.e., not paying attention right now)?</li>
<li>Is this person simply gone (i.e., no longer participating in the chat)?</li>
</ul>
<p>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. <note>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.</note></p>
</section1>
<section1 topic='Definitions' anchor='definitions'>
<p>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.</p>
<p>Chat state notifications can appear in two kinds of &MESSAGE; stanzas:</p>
<ul>
<li>A "content message" -- that is, a message stanza whose primary meaning is contained in standard messaging content such as the XMPP &lt;body/&gt; or any other properly-namespaced child element(s) other than those defined for chat state notifications in this specification.</li>
<li>A "standalone notification" -- that is, a message stanza that does not contain standard messaging content but instead is intended to specify only the chat state since it contains only a child element qualified by the "http://jabber.org/protocol/chatstates" namespace (or possibly also the XMPP &lt;thread/&gt; element; see the <link url='#bizrules-threads'>Threads</link> section below).</li>
</ul>
<p>The five chat states specified in this document are described below. The suggested triggers are simply that: <em>suggestions</em>. It is up to the implementation to determine when to generate chat state notifications and which notifications to generate.</p>
<table caption='Chat States'>
<tr>
<th>State</th>
<th>Definition</th>
<th>Suggested Triggers</th>
</tr>
<tr>
<td>&lt;active/&gt;</td>
<td>User is actively participating in the chat session.</td>
<td>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.</td>
</tr>
<tr>
<td>&lt;inactive/&gt;</td>
<td>User has not been actively participating in the chat session.</td>
<td>User has not interacted with the chat session interface for an intermediate period of time (e.g., 2 minutes).</td>
</tr>
<tr>
<td>&lt;gone/&gt;</td>
<td>User has effectively ended their participation in the chat session.</td>
<td>User has not interacted with the chat session interface, system, or device for a relatively long period of time (e.g., 10 minutes).</td>
</tr>
<tr>
<td>&lt;composing/&gt;</td>
<td>User is composing a message.</td>
<td>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).</td>
</tr>
<tr>
<td>&lt;paused/&gt;</td>
<td>User had been composing but now has stopped.</td>
<td>User was composing but has not interacted with the message input interface for a short period of time (e.g., 30 seconds).</td>
</tr>
</table>
<p>Note that the &lt;active/&gt;, &lt;inactive/&gt;, and &lt;gone/&gt; states refer to the overall chat session interface whereas the &lt;composing/&gt; and &lt;paused/&gt; states refer to the message input interface (and are in some sense a subset of &lt;active/&gt;). 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.</p>
</section1>
<section1 topic='State Chart' anchor='statechart'>
<p>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).</p>
<code><![CDATA[
o (start)
|
|
INACTIVE <--> ACTIVE <--> COMPOSING <--> PAUSED
| |
| |
+---<---<---<---<---<---<---<---<---<---+
]]></code>
<p>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).</p>
</section1>
<section1 topic='Determining Support' anchor='support'>
<p>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":</p>
<example caption='A disco#info query'><![CDATA[
<iq from='romeo@shakespeare.lit/orchard'
id='disco1'
to='juliet@capulet.com/balcony'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption='A disco#info response'><![CDATA[
<iq from='juliet@capulet.com/balcony'
id='disco1'
to='romeo@shakespeare.lit/orchard'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<feature var='http://jabber.org/protocol/chatstates'/>
</query>
</iq>
]]></example>
<p>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.</p>
</section1>
<section1 topic='Business Rules' anchor='bizrules'>
<section2 topic='Generation of Notifications' anchor='bizrules-gen'>
<p>Before generating chat state notifications, a User SHOULD explicitly discover whether the Contact supports the protocol defined herein (as described in the <link url='#disco'>Discovering Support</link> section of this document) or explicitly negotiate the use of chat state notifications with the Contact (e.g., via &xep0155;).</p>
<p>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:</p>
<ol start='1'>
<li>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 &lt;active/&gt;.</li>
<li>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.</li>
<li>If the Contact replies and includes an &lt;active/&gt; 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 &lt;active/&gt; notification in each content message and sending standalone notifications for the chat states they support (at a minimum, the &lt;composing/&gt; state).</li>
</ol>
<p>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.</p>
</section2>
<section2 topic='Support Requirements' anchor='bizrules-support'>
<table caption='Requirements for Supporting Each Chat State'>
<tr>
<th>Chat State</th>
<th>Requirement</th>
</tr>
<tr>
<td>&lt;active/&gt;</td>
<td>MUST</td>
</tr>
<tr>
<td>&lt;composing/&gt;</td>
<td>MUST</td>
</tr>
<tr>
<td>&lt;paused/&gt;</td>
<td>SHOULD</td>
</tr>
<tr>
<td>&lt;inactive/&gt;</td>
<td>SHOULD</td>
</tr>
<tr>
<td>&lt;gone/&gt;</td>
<td>SHOULD</td>
</tr>
</table>
<p>A client MUST allow users to configure whether they want to send chat state notifications.</p>
<p>Note: Support for only &lt;active/&gt; and &lt;composing/&gt; is functionally equivalent to supporting the Composing event from <cite>XEP-0022</cite>.</p>
</section2>
<section2 topic='Repetition' anchor='bizrules-rep'>
<p>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 &lt;composing/&gt; 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 &lt;active/&gt; notification.</p>
</section2>
<section2 topic='Context of Usage' anchor='bizrules-context'>
<ol>
<li>This protocol MUST NOT be used with stanzas other than &MESSAGE;.</li>
<li>This protocol SHOULD NOT be used with message types other than "chat" or "groupchat".</li>
<li>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).</li>
<li>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.</li>
</ol>
</section2>
<section2 topic='Use in Groupchat' anchor='bizrules-groupchat'>
<p>Chat state notifications MAY be sent in the context of groupchat rooms (e.g., as defined in &xep0045;). The following business rules apply:</p>
<ol>
<li>A client MAY send chat state notifications even if not all room occupants do so.</li>
<li>A client SHOULD NOT generate &lt;gone/&gt; notifications.</li>
<li>A client SHOULD ignore &lt;gone/&gt; notifications received from other room occupants.</li>
</ol>
<p>Note: Use of chat state notifications in the context of groupchat can result in multicasting of such notifications. Forewarned is forearmed.</p>
</section2>
<section2 topic='Syntax of Notifications' anchor='bizrules-syntax'>
<ol>
<li>A message stanza MUST NOT contain more than one child element qualified by the 'http://jabber.org/protocol/chatstates' namespace.</li>
<li>A message stanza that contains standard instant messaging content SHOULD NOT contain a chat state notification extension other than &lt;active/&gt;, where "standard instant messaging content" is taken to mean the &lt;body/&gt;, &lt;subject/&gt;, and &lt;thread/&gt; 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;.</li>
<li>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 &lt;active/&gt;; however, if threads are used (see below) then the standalone notification MUST also contain the &lt;thread/&gt; element.</li>
</ol>
</section2>
<section2 topic='Threads' anchor='bizrules-threads'>
<p>While chat state notifications provide a mechanism for managing chat threads as communicated by inclusion of the XMPP &lt;thread/&gt; 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:</p>
<ol>
<li>Clients MUST copy back Thread IDs (i.e., the value of the &lt;thread/&gt; element) in any replies.</li>
<li>When a client terminates a one-to-one chat session (e.g., when a user closes the chat session interface), it MUST generate a &lt;gone/&gt; event.</li>
<li>Upon receiving a &lt;gone/&gt; 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.</li>
</ol>
</section2>
<section2 topic='Server Handling of Notifications' anchor='bizrules-notify'>
<p>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 <cite>XEP-0022</cite>, chat state notifications are completely the responsibility of the client, and MUST NOT be generated by a server or service.</p>
</section2>
</section1>
<section1 topic='A Simple Example' anchor='example-basic'>
<p>In the following conversation, both User &lt;bernardo@shakespeare.lit&gt; and Contact &lt;francisco@shakespeare.lit&gt; support chat state notifications.</p>
<example caption="User Sends Initial Content Message With &lt;active/&gt; Notification"><![CDATA[
<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>
<example caption="Contact's Client Sends Content Message Reply With &lt;active/&gt; Notification"><![CDATA[
<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>
]]></example>
<p>Because the User now knows that the Contact supports chat state notifications, the User can send other notification types.</p>
<example caption="User Sends Standalone &lt;composing/&gt; Notification"><![CDATA[
<message
from='bernardo@shakespeare.lit/pda'
to='francisco@shakespeare.lit/elsinore'
type='chat'>
<composing xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<example caption="User Sends a Content Message Reply With &lt;active/&gt; Notification"><![CDATA[
<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>
]]></example>
<p>And so forth.</p>
</section1>
<section1 topic='A Detailed Conversation' anchor='example-detail'>
<p>The following conversation flow illustrates in more detail the workings of chat state notifications (in this case also using threads) between a User &lt;romeo@shakespeare.lit&gt; and a Contact &lt;juliet@capulet.com&gt;.</p>
<example caption="User Sends Initial Content Message"><![CDATA[
<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>
]]></example>
<p>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 &lt;active/&gt;:</p>
<example caption="Contact's Client Sends Content Message Reply With &lt;active/&gt; Notification"><![CDATA[
<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>
]]></example>
<p>And so the conversation continues. After a while, Juliet asks a question that brings Romeo up short:</p>
<example caption="Contact Sends Another Message"><![CDATA[
<message
from='juliet@capulet.com/balcony'
to='romeo@shakespeare.lit/orchard'
type='chat'>
<thread>act2scene2chat1</thread>
<body>Art thou not Romeo, and a Montague?</body>
</message>
]]></example>
<p>Romeo begins composing a reply to Juliet's heartfelt question, and his client notifies Juliet that he is composing a reply.</p>
<example caption="User's Client Sends Standalone &lt;composing/&gt; Notification"><![CDATA[
<message
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'
type='chat'>
<thread>act2scene2chat1</thread>
<composing xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<p>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 &lt;paused/&gt;.</p>
<example caption="User's Client Sends Standalone &lt;paused/&gt; Notification"><![CDATA[
<message
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'
type='chat'>
<thread>act2scene2chat1</thread>
<paused xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<p>Romeo starts composing again, and his Jabber client sends a &lt;composing/&gt; notification to Juliet's client.</p>
<example caption="User's Clients Sends Standalone &lt;composing/&gt; Notification"><![CDATA[
<message
from='romeo@montague.net/orchard'
to='juliet@capulet.com/balcony'
type='chat'>
<thread>act2scene2chat1</thread>
<composing xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<p>Romeo finally sends his reply.</p>
<example caption="User Replies"><![CDATA[
<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>
]]></example>
<p>The conversation ebbs and flows, waxes and wanes, until Juliet is called away by her Nurse...</p>
<example caption="Contact's Client Sends Content Message"><![CDATA[
<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>
]]></example>
<p>We suppose that Juliet minimizes the chat window, so her client generates an &lt;inactive/&gt; notification:</p>
<example caption="Contact's Client Sends Standalone &lt;inactive/&gt; Notification"><![CDATA[
<message
from='juliet@capulet.com/balcony'
to='romeo@shakespeare.lit/orchard'
type='chat'>
<thread>act2scene2chat1</thread>
<inactive xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<p>When she returns and brings the window up again, her client generates an &lt;active/&gt; notification:</p>
<example caption="Contact's Client Sends Standalone &lt;active/&gt; Notification"><![CDATA[
<message
from='juliet@capulet.com/balcony'
to='romeo@shakespeare.lit/orchard'
type='chat'>
<thread>act2scene2chat1</thread>
<active xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<p>The conversation continues, but Juliet is called away again by that nagging Nurse:</p>
<example caption="Contact's Client Sends Content Message"><![CDATA[
<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>
]]></example>
<p>We suppose that Juliet closes the chat window, so her client generates a &lt;gone/&gt; notification:</p>
<example caption="Contact's Client Sends Standalone &lt;gone/&gt; Notification"><![CDATA[
<message
from='juliet@capulet.com/balcony'
to='romeo@shakespeare.lit/orchard'
type='chat'>
<thread>act2scene2chat1</thread>
<gone xmlns='http://jabber.org/protocol/chatstates'/>
</message>
]]></example>
<p>Romeo's client now considers the chat thread to be over and generates a new Thread ID when he sends a new message:</p>
<example caption="User's Client Sends Content Message with New Thread ID"><![CDATA[
<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>
]]></example>
<p>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 &lt;active/&gt; notification and the new Thread ID with the body of her reply:</p>
<example caption="Contact's Client Sends Content Message"><![CDATA[
<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>
]]></example>
<p>And so forth.</p>
<p>My, these star-crossed lovers do go on, don't they?</p>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<p>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.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>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.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>The &REGISTRAR; includes 'http://jabber.org/protocol/chatstates' in its registry of protocol namespaces.</p>
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?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:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-0085: http://www.xmpp.org/extensions/xep-0085.html
</xs:documentation>
</xs:annotation>
<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>
]]></code>
</section1>
</xep>