This commit is contained in:
Peter Saint-Andre 2012-07-28 06:47:31 -06:00
parent 7c40c6859c
commit c0a105f8cf
1 changed files with 142 additions and 162 deletions

View File

@ -26,9 +26,18 @@
<surname>Rejhon</surname>
<email>mark@realjabber.org</email>
<jid>markybox@gmail.com</jid>
<org>RealJabber.org and Rejhon Technologies Inc.</org>
<uri>http://www.realjabber.com</uri>
<uri>http://www.realjabber.org</uri>
</author>
<revision>
<version>0.6</version>
<date>2012-07-28</date>
<initials>MDR</initials>
<remark><p>Changes and improvements in preparation for advance to Draft. Unified
&lt;e/&gt; element (Erase Text) to handle all possible text deletions.
Clarify the Unicode terminology used in this specification, and move
section 4.5.4 downwards to section 4.7 to improve reading
order.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2012-07-22</date>
@ -83,21 +92,21 @@
<section1 topic="Introduction" anchor="introduction">
<p>This document defines a specification for real-time text transmitted in-band over an XMPP network.</p>
<p><strong>Real-time text is text transmitted instantly while it is being typed or created.</strong> The recipient can immediately read the sender's text as it is written, without waiting. Text can be used conversationally, similar to a telephone conversation, where one listens while the other is speaking. It eliminates waiting times found in messaging, and is favored by deaf and hard of hearing individuals who prefer text conversation. For a visual animation of real-time text, see <span class="ref"><strong><link url="http://www.realjabber.org">RealJabber.org</link></strong></span>
<note>RealJabber.org, the author's website covering this specification, including animation examples of what real time text looks like. &lt;<link url="http://www.realjabber.org">http://www.realjabber.org</link>&gt;.</note>.</p>
<p><strong>Real-time text is text transmitted instantly while it is being typed or created.</strong> The recipient can immediately read the sender's text as it is written, without waiting. Text can be used conversationally, similar to a telephone conversation, where one listens while the other is speaking. It eliminates waiting times found in messaging, and is favored by deaf and hard of hearing individuals who prefer text conversation.</p>
<p>Real-time text has been around for decades in various implementations:</p>
<ul>
<li>The 'talk' command on UNIX systems since the 1970's.</li>
<li>ICQ had a peer-to-peer split screen mode from 1996-1999.</li>
<li>TTY and text telephones for the deaf and hard of hearing.</li>
<li>For SIP, real-time text is sent using <span class="ref"><strong><link url="http://tools.ietf.org/html/rfc4103">IETF RFC 4103</link></strong></span> <note>IETF RFC 4103: RTP Payload for Text Conversation. &lt;<link url="http://tools.ietf.org/html/rfc4103">http://tools.ietf.org/html/rfc4103</link>&gt;.</note> with <span class="ref"><strong><link url="http://www.itu.int/rec/T-REC-T.140">ITU-T T.140</link></strong></span> <note>ITU-T T.140: Protocol for multimedia application text conversation. &lt;<link url="http://www.itu.int/rec/T-REC-T.140">http://www.itu.int/rec/T-REC-T.140</link>&gt;.</note> presentation coding.</li>
<li>For SIP, real-time text is sent using <span class="ref"><strong><link url="http://tools.ietf.org/html/rfc4103">IETF RFC 4103</link></strong></span> <note>RFC 4103: RTP Payload for Text Conversation. &lt;<link url="http://tools.ietf.org/html/rfc4103">http://tools.ietf.org/html/rfc4103</link>&gt;.</note> with <span class="ref"><strong><link url="http://www.itu.int/rec/T-REC-T.140">ITU-T T.140</link></strong></span> <note>ITU-T T.140: Protocol for multimedia application text conversation. &lt;<link url="http://www.itu.int/rec/T-REC-T.140">http://www.itu.int/rec/T-REC-T.140</link>&gt;.</note> presentation coding.</li>
<li>In 2008, AOL AIM 6.8 gained the <span class="ref"><strong><link url="http://help.aol.com/help/microsites/microsite.do?cmd=displayKC&amp;externalId=223568">AOL Real-Time IM</link></strong></span> <note>AOL AIM Real Time Text: &lt;<link url="http://help.aol.com/help/microsites/microsite.do?cmd=displayKC&amp;externalId=223568">http://help.aol.com/help/microsites/microsite.do?cmd=displayKC&amp;externalId=223568</link>&gt;.</note> feature.</li>
<li>A component within Total Conversation, used by <span class="ref"><strong><link url="http://www.reach112.eu">Reach112</link></strong></span> <note>Reach112: European emergency service with real-time text. &lt;<link url="http://www.reach112.eu">http://www.reach112.eu</link>&gt;.</note> in Europe, an accessible emergency service with real-time text.</li>
</ul>
<p>Real-time text is suitable for smooth and rapid mainstream communication in text, as an all-inclusive technology to complement instant messaging. It can also allow immediate conversation in situations where speech cannot be used (e.g. quiet environments, privacy, deaf and hard of hearing). Real-time text is also beneficial in emergency situations, due to its immediacy.</p>
<p>Real-time text is suitable for smooth and rapid mainstream communication in text, as an all-inclusive technology to complement instant messaging. It can also allow immediate conversation in situations where speech cannot be used (e.g. quiet environments, privacy, deaf and hard of hearing). Real-time text is also beneficial in emergency situations, due to its immediacy. For a visual animation of real-time text, see <span class="ref"><strong><link url="http://www.realtimetext.org">Real-Time Text Taskforce</link></strong></span>
<note>Real-Time Text Taskforce, a foundation for real-time text standardization &lt;<link url="http://www.realtimetext.org">http://www.realtimetext.org</link>&gt;.</note>.</p>
</section1>
<section1 topic="Requirements" anchor="requirements">
<section2 topic="Fluid Real-Time Text" anchor="fluid_realtime_text">
@ -121,7 +130,7 @@
<li>Allow use within existing instant-messaging user interfaces, with minimal UI modifications.</li>
<li>Allow alternate optional presentations of real-time text, including split screen and/or other layouts.</li>
<li>Protocol design ensures integrity of real-time text, and allows extensions for new features.</li>
<li>Be interoperable with other real-time text protocols via gateways, including RFC 4103 and ITU-T T.140.</li>
<li>Allow use within gateways to interoperate with other real-time text protocols, including RFC 4103 and ITU-T T.140.</li>
</ol>
</section2>
<section2 topic="Accessible" anchor="accessible">
@ -129,7 +138,7 @@
<li>Allow XMPP to follow the <span class="ref"><strong><link url="http://www.itu.int/rec/T-REC-F.703">ITU-T Rec. F.703</link></strong></span> <note>ITU-T Rec. F.703: Multimedia conversational services. &lt;<link url="http://www.itu.int/rec/T-REC-F.703">http://www.itu.int/rec/T-REC-F.703</link>&gt;.</note> Total Conversation standard for simultaneous voice, video, and real-time text.</li>
<li>Be a candidate technology for use with Next Generation 9-1-1 / 1-1-2 emergency services.</li>
<li>Be suitable for transcription services and (when coupled with voice at user's choice) for TTY/text telephone alternatives, relay services, and captioned telephone systems.</li>
<li>Be an accessible enhancement for mobile phone text messaging and mainstream instant messaging.</li>
<li>Allow immediate conversational text through mobile phone text messaging and mainstream instant messaging.</li>
</ol>
</section2>
</section1>
@ -142,7 +151,7 @@
</section1>
<section1 topic="Protocol" anchor="protocol">
<section2 topic="RTT Element" anchor="rtt_element">
<p>Real-time text is transmitted via an &lt;rtt/&gt; child element of a &lt;message/&gt; stanza. The &lt;rtt/&gt; element is transmitted at regular intervals by the sender client while a message is being composed, to allow the recipient to see the sender type the message, without waiting for the full message sent in a &lt;body/&gt; element.</p>
<p>Real-time text is transmitted via an &lt;rtt/&gt; child element of a &lt;message/&gt; stanza. The &lt;rtt/&gt; element is transmitted at regular intervals by the sender client while a message is being composed, to allow the recipient to see the latest message text, without waiting for the full message sent in a &lt;body/&gt; element.</p>
<p>This is a basic example of a <em><strong>real-time message</strong></em> "Hello, my Juliet!” transmitted in real-time while it is being typed, before a final message delivery in a &lt;body/&gt; element (to remain <link url="#backwards_compatible">Backwards Compatible</link>):</p>
<p><strong>Example 1: Introductory Example</strong></p>
<p><code><![CDATA[<message to='juliet@capulet.lit' from='romeo@montague.lit/orchard' type='chat' id='a01'>
@ -177,11 +186,11 @@
<section2 topic="RTT Attributes" anchor="rtt_attributes">
<section3 topic="seq" anchor="seq">
<p>This REQUIRED attribute is a counter to maintain the integrity of real-time text. (The bounds of <strong>seq</strong> is 31-bits, the range of positive values of a signed integer.)</p>
<p>Senders MUST increment the <strong>seq</strong> attribute by 1 in each subsequent &lt;rtt/&gt; transmitted without an <link url="#event">event</link> attribute. When an &lt;rtt/&gt; element has an <link url="#event">event</link> attribute, senders MAY instead use any value as the new starting value for <strong>seq</strong>. A random starting <strong>seq</strong> value is RECOMMENDED for best integrity during <link url="#usage_with_multiuser_chat_and_simultaneous_logins">Usage with Multi-User Chat and Simultaneous Logins</link>. Senders MAY limit the size of the new starting <strong>seq</strong> value, to keep &lt;rtt/&gt; compact while allowing plenty of incrementing room without overflow.</p>
<p>Senders MUST increment the <strong>seq</strong> attribute by 1 in each subsequent &lt;rtt/&gt; transmitted without an <link url="#event">event</link> attribute. When an &lt;rtt/&gt; element has an <link url="#event">event</link> attribute, senders MAY instead use any value as the new starting value for <strong>seq</strong>. A random starting <strong>seq</strong> value is RECOMMENDED for best integrity during <link url="#usage_with_multiuser_chat_and_simultaneous_logins">Usage with Multi-User Chat and Simultaneous Logins</link>. Senders SHOULD limit the size of the new starting <strong>seq</strong> value, to keep &lt;rtt/&gt; compact while allowing plenty of incrementing room, and prevent wraparound from ever happening.</p>
<p>Recipients MUST monitor the <strong>seq</strong> value to verify the integrity of real-time text. See <link url="#keeping_realtime_text_synchronized">Keeping Real-Time Text Synchronized</link>.</p>
</section3>
<section3 topic="event" anchor="event">
<p>This attribute signals events for real-time text, such as the start of a new real-time message. The <strong>event</strong> attribute MAY be omitted from the &lt;rtt/&gt; element during regular real-time text transmission. Recipients MUST ignore &lt;rtt/&gt; containing unsupported <strong>event</strong> values.</p>
<p>This attribute signals events for real-time text, such as the start of a new real-time message. Recipient clients MUST ignore &lt;rtt/&gt; containing unsupported <strong>event</strong> values. The use of &lt;rtt/&gt; elements without an <strong>event</strong> attribute is for transmitting changes to an existing real-time message. The <strong>event</strong> attribute is used in the situations specified below:</p>
<table>
<tr>
<th>event</th>
@ -198,38 +207,38 @@
<tr>
<td>reset</td>
<td>Reset the current real-time message.</td>
<td><strong>RECOMMENDED</strong></td>
<td>RECOMMENDED</td>
<td><strong>REQUIRED</strong></td>
</tr>
<tr>
<td>init</td>
<td>Initiate a real-time text session.</td>
<td>OPTIONAL</td>
<td>OPTIONAL</td>
<td>RECOMMENDED</td>
</tr>
<tr>
<td>cancel</td>
<td>End a real-time text session.</td>
<td>OPTIONAL</td>
<td>OPTIONAL</td>
<td>RECOMMENDED</td>
</tr>
</table>
<p><strong>event='new'</strong><br />
Senders MUST use this value when transmitting the first &lt;rtt/&gt; element containing <link url="#action_elements">Action Elements</link> (i.e. the first character(s) of a new message). Recipient clients MUST initialize a new real-time message for display, and then process action elements within the &lt;rtt/&gt; element. If a real-time message already exists in the same chat session, its content MUST be replaced (i.e. cleared prior to processing action elements). Senders MAY send subsequent &lt;rtt/&gt; elements that do not contain an <strong>event</strong> attribute.</p>
<p><strong>event='reset'</strong><br />
Recipients MUST treat <strong>'reset'</strong> the same as <strong>'new'</strong>. Senders MUST use <strong>'new'</strong> only when the sender has started composing a new message, and use '<strong>reset'</strong> when re-transmitting a real-time message. See <link url="#message_reset">Message Reset</link>, used for <link url="#keeping_realtime_text_synchronized">Keeping Real-Time Text Synchronized</link> and <link url="#basic_realtime_text">Basic Real-Time Text</link>.</p>
For recipients, both <strong>'new'</strong> and <strong>'reset'</strong> are logically identical, and differ only for implementation purposes (e.g. highlighting newly-started messages). Recipient clients MUST initialize a new real-time message for display, and then process action elements within the &lt;rtt/&gt; element. If a real-time message already exists in the same chat session, its content MUST be replaced (i.e. cleared prior to processing action elements). Senders MAY send subsequent &lt;rtt/&gt; elements that do not contain an <strong>event</strong> attribute. Recipients MUST be able to process <strong>'reset'</strong> without first receiving <strong>'new'</strong>. See <link url="#message_reset">Message Reset</link>, used for <link url="#keeping_realtime_text_synchronized">Keeping Real-Time Text Synchronized</link> and <link url="#basic_realtime_text">Basic Real-Time Text</link>.</p>
<p><strong>event='init'</strong><br />
Clients MAY use this value to signal the other end that real-time text is being activated. If used, this &lt;rtt/&gt; element MUST be empty with no action elements. See <link url="#activating_and_deactivating_realtime_text">Activating and Deactivating Real-Time Text</link>.</p>
Clients MAY use this value to signal the other end that real-time text is being activated. It can be used to signal activation of real-time text before starting a new real-time message. If used, this &lt;rtt/&gt; element MUST be empty with no action elements. See <link url="#activating_and_deactivating_realtime_text">Activating and Deactivating Real-Time Text</link>.</p>
<p><strong>event='cancel'</strong><br />
Clients MAY use this value to signal the other end to stop transmitting real-time text. If used, this &lt;rtt/&gt; element MUST be empty with no action elements. Recipients SHOULD discontinue sending back &lt;rtt/&gt; elements for the remainder of the same chat session (or unless <strong>'init'</strong> is used again). See <link url="#activating_and_deactivating_realtime_text">Activating and Deactivating Real-Time Text</link>.</p>
</section3>
<section3 topic="id" anchor="id">
<p>This OPTIONAL attribute is used only if &xep0308; (XEP-0308) is implemented. Sender clients MAY use this attribute to allow recipient clients to have improved presentation of real-time text during message correction (e.g. shown as in-place editing of previous message).</p>
<p>This <strong>id</strong> attribute refers to the &lt;message/&gt; stanza containing the &lt;body/&gt; that is being edited (See 'Business Rules' in XEP-0308). If used at all, then <strong>id</strong> MUST be included in all &lt;rtt/&gt; elements transmitted during message correction of the previous message. When switching messages being edited (i.e. editing the current message versus editing the previous message), the first &lt;rtt/&gt; element MUST contain an <link url="#event">event</link> attribute value, such as 'reset' (See <link url="#message_reset">Message Reset</link>).</p>
<p>This attribute is used only if &xep0308; (XEP-0308) is implemented at the same time as this specification. If a client supports both XEP-0301 and XEP-0308, clients SHOULD use this attribute to allow recipient clients to have improved presentation of real-time text during message correction (e.g. shown as in-place editing of previous message).</p>
<p>This <strong>id</strong> attribute refers to the &lt;message/&gt; stanza containing the &lt;body/&gt; that is being edited (See 'Business Rules' in XEP-0308). When used, <strong>id</strong> MUST be included in all &lt;rtt/&gt; elements transmitted during message correction of the previous message. A <link url="#message_reset">Message Reset</link> MUST be used when switching between messages being edited (i.e. switching between editing the new partially-composed message versus editing of the previously delivered message).</p>
</section3>
</section2>
<section2 topic="Body Element" anchor="body_element">
<p>The real-time message is considered complete upon receipt of a &lt;body/&gt; element in a message stanza. The delivered message in the &lt;body/&gt; element is displayed instead of the real-time message. In the ideal case, the message from &lt;body/&gt; is redundant since this delivered message is identical to the final contents of the real-time message.</p>
<p>The real-time message is considered complete upon receipt of a &lt;body/&gt; element in a &lt;message/&gt; stanza. The delivered text in the &lt;body/&gt; element is considered the final message text, and supersedes the real-time message. In the ideal case, the text from &lt;body/&gt; is redundant since this delivered text is identical to the final contents of the real-time message.</p>
<p>Senders MUST include an <link url="#event">event</link> attribute in the next &lt;rtt/&gt; element that is transmitted after a message stanza containing a &lt;body/&gt; element.</p>
<section3 topic="Backwards Compatible" anchor="backwards_compatible">
<p>The real-time text standard simply provides early delivery of text before the &lt;body/&gt; element. The &lt;body/&gt; element continues to follow the &xmppcore; specification. In particular, XMPP implementations need to ignore XML elements they do not understand. Clients, that do not support real-time text, will continue to behave normally, displaying complete lines of messages as they are delivered.</p>
@ -237,8 +246,7 @@
</section2>
<section2 topic="Transmission Interval" anchor="transmission_interval">
<p>For the best balance between interoperability and usability, the default transmission interval of &lt;rtt/&gt; elements for a continuously-changing message SHOULD be approximately <strong>0.7 second</strong>. This interval meets ITU-T Rec. F.700 Section A.3.2.1 for good quality real-time conversation. If a different transmission interval needs to be used, the interval SHOULD be <strong>between 0.3 second and 1 second</strong>.</p>
<p>A longer interval will lead to a less optimal user experience in most network conditions. Conversely, a much shorter interval may more frequently trigger throttling or flooding protection algorithms in public XMPP servers, leading to dropped &lt;message/&gt; elements and/or <link url="#congestion_considerations">Congestion Considerations</link>.</p>
<p>To provide fluid real-time text, one or more of the following methods can be used:</p>
<p>A longer interval will lead to a less optimal user experience in most network conditions. Conversely, a much shorter interval can lead to <link url="#congestion_considerations">Congestion Considerations</link>. To provide fluid real-time text, one or more of the following methods can be used:</p>
<ul>
<li><link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> for natural typing display, independently of the transmission interval.</li>
<li>Use of <link url="#time_critical_and_low_latency_methods">Time Critical and Low Latency Methods</link>, for real-time captioning/transcription.</li>
@ -247,9 +255,9 @@
</section2>
<section2 topic="Real-Time Text Actions" anchor="realtime_text_actions">
<p>The &lt;rtt/&gt; element MAY contain one or more <em><strong>action elements</strong></em> representing real-time text operations, including text being appended, inserted, or deleted.</p>
<p>Many chat clients allow a sender to edit their message before sending (via a Send button, or pressing Enter). The inclusion of real-time text functionality, in existing client software, needs to preserve the sender's existing expectation of being able to edit their messages. In a chat session with real-time text, the recipient can watch the sender compose and edit their message before it is completed.</p>
<p>Many chat clients allow a sender to edit their message before sending (via a Send button, or pressing Enter). The inclusion of real-time text functionality, in existing client software, needs to preserve the sender's existing expectation of being able to edit their messages. In a chat session with real-time text, the recipient can see the sender compose and edit their message before it is completed.</p>
<section3 topic="Action Elements" anchor="action_elements">
<p>This is a short summary of action elements that operate on a real-time message. For detailed information, see <link url="#list_of_action_elements">List of Action Elements</link>.</p>
<p>This is a short summary of action elements that operate on a real-time message. These elements are kept compact in order to save bandwidth, since a single &lt;rtt/&gt; element can contain a huge number of action elements (e.g. during <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>). For detailed information, see <link url="#list_of_action_elements">List of Action Elements</link>.</p>
<table>
<tr>
<th>Action</th>
@ -266,19 +274,12 @@
<td><strong>REQUIRED</strong></td>
</tr>
<tr>
<td>Backspace</td>
<td>Erase&nbsp;Text</td>
<td>&lt;e&nbsp;p='#'&nbsp;n='#'/&gt;</td>
<td>Remove <em><strong>n</strong></em> characters before position <em><strong>p</strong></em> in message<em>.</em></td>
<td>RECOMMENDED</td>
<td><strong>REQUIRED</strong></td>
</tr>
<tr>
<td>Forward&nbsp;Delete</td>
<td>&lt;d&nbsp;p='#'&nbsp;n='#'/&gt;</td>
<td>Remove <em><strong>n</strong></em> characters starting at position <em><strong>p</strong></em> in message.</td>
<td>RECOMMENDED</td>
<td><strong>REQUIRED</strong></td>
</tr>
<tr>
<td>Wait&nbsp;Interval</td>
<td>&lt;w&nbsp;n='#'/&gt;</td>
@ -288,19 +289,18 @@
</tr>
</table>
</section3>
<section3 topic="Summary of Attribute Values" anchor="summary_of_attribute_values">
<section3 topic="Attribute Values" anchor="attribute_values">
<ul>
<li><p>The <em><strong>n</strong></em> attribute is a length value.<br />
If <em><strong>n</strong></em> is omitted, the default value of <em><strong>n</strong></em> MUST be 1.</p></li>
<li><p>The <em><strong>p</strong></em> attribute is an absolute position value, as a 0-based index (0 represents beginning of message).<br />
If <em><strong>p</strong></em> is omitted, the default value of <em><strong>p</strong></em> MUST be the current message length (<em><strong>p</strong></em> defaults to end of message).</p></li>
<li><p>For text modifications, length and position (<em><strong>n</strong></em> and <em><strong>p</strong></em>) is based on <link url="#unicode_character_counting">Unicode Character Counting</link>.<br />
Also see <link url="#accurate_processing_of_action_elements">Accurate Processing of Action Elements</link>.</p></li>
<li><p>Senders MUST NOT use negative values for any attribute, nor use <em><strong>p</strong></em> values beyond the current message length. However, recipients receiving such values MUST clip negative values to 0, and clip excessively high <em><strong>p</strong></em> values to the current length of the real-time message. Modifications only occur within the boundaries of the current real-time message, and not in other delivered messages.</p></li>
<li><p>For <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link>:<br />
The <em><strong>n</strong></em> attribute is a length value, in number of characters. If <em><strong>n</strong></em> is omitted, the default value of <em><strong>n</strong></em> MUST be 1.</p></li>
<li><p>For <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> and <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link>:<br />
The <em><strong>p</strong></em> attribute is an absolute position value, as a character position index into the real-time message, where 0 represents the beginning of the message. If <em><strong>p</strong></em> is omitted, the default value of <em><strong>p</strong></em> MUST point to the end of the message (i.e. <em><strong>p</strong></em> is set to the current length of the real-time message).</p></li>
<li><p>For the purpose of this specification, the word "character" represents a single Unicode code point. See <link url="#unicode_character_counting">Unicode Character Counting</link>.</p></li>
<li><p>Senders MUST NOT use negative values for any attribute, nor use <em><strong>p</strong></em> values beyond the current message length. However, recipients receiving such <em><strong>p</strong></em> values MUST clip negative values to 0, and clip excessively high <em><strong>p</strong></em> values to the current length of the real-time message. Modifications only occur within the boundaries of the current real-time message.</p></li>
</ul>
</section3>
<section3 topic="List of Action Elements" anchor="list_of_action_elements">
<p>Recipients MUST be able to process all &lt;t/&gt;, &lt;e/&gt; and &lt;d/&gt; action elements for incoming &lt;rtt/&gt; transmissions, even if senders do not use all of these for outgoing &lt;rtt/&gt; transmissions (e.g. <link url="#basic_realtime_text">Basic Real-Time Text</link>). Support for &lt;w/&gt; is RECOMMENDED for both senders and recipients, in order to accommodate <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>. Recipients MUST ignore unexpected or unsupported elements within &lt;rtt/&gt;, while continuing to process subsequent action elements (Compatibility is ensured via <link url="#namespace_versioning">Namespace Versioning</link>). Action elements are immediate child elements of the &lt;rtt/&gt; element, and are never nested. See examples in <link url="#use_cases">Use Cases</link>.</p>
<p>Recipients MUST be able to process all &lt;t/&gt; and &lt;e/&gt; action elements for incoming &lt;rtt/&gt; transmissions, even if senders do not use all of these for outgoing &lt;rtt/&gt; transmissions (e.g. <link url="#basic_realtime_text">Basic Real-Time Text</link>). Support for &lt;w/&gt; is RECOMMENDED for both senders and recipients, in order to accommodate <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>. Recipients MUST ignore unexpected or unsupported elements within &lt;rtt/&gt;, while continuing to process subsequent action elements (Compatibility is ensured via <link url="#namespace_versioning">Namespace Versioning</link>). Action elements are immediate child elements of the &lt;rtt/&gt; element, and are never nested. See examples in <link url="#use_cases">Use Cases</link>.</p>
<section4 topic="Element &lt;t/&gt; Insert Text" anchor="element_t_insert_text">
<p>Support the transmission of text, including key presses, and text block inserts.<br />
<em>Note: Text can be any</em> <em>subset of text allowed in the &lt;body/&gt; element of a &lt;message/&gt;. If &lt;t/&gt; is empty, no text modification takes place.</em></p>
@ -313,81 +313,46 @@
</section4>
<section4 topic="Element &lt;e/&gt; Backspace" anchor="element_e_backspace">
<p>Support the behavior of Backspace key presses. Text is removed towards beginning of the message.<br />
<em>Note: Excess backspaces MUST be ignored, with text being backspaced only to the beginning of the message in this case.</em></p>
<section4 topic="Element &lt;e/&gt; Erase Text" anchor="element_e_erase_text">
<p>Support the behavior of Backspace key presses. Text is removed towards beginning of the message. This element is also used for all delete operations, including the Delete key, and text block deletes.<br />
<em>Note: Excess backspaces MUST be ignored. Thus, text is backspaced only to the beginning of the message, in situations where the value of p is excessively large.</em></p>
<p><code><![CDATA[<e/>]]></code></p>
<p>Remove 1 character from end of message. (Both <em><strong>n</strong></em> and <em><strong>p</strong></em> at default values)</p>
<p>Remove 1 character from end of message. (<em><strong>n</strong></em> defaults to 1, and <em><strong>p</strong></em> defaults to message length)</p>
<p><code><![CDATA[<e p='#'/>]]></code></p>
<p>Remove 1 character before position <em><strong>p</strong></em> in message. (<em><strong>n</strong></em> defaults to 1)</p>
<p>Remove 1 character before character position <em><strong>p</strong></em> in message. (<em><strong>n</strong></em> defaults to 1)</p>
<p><code><![CDATA[<e n='#'/>]]></code></p>
<p>Remove <em><strong>n</strong></em> characters from end of message. (<em><strong>p</strong></em> defaults to message length)</p>
<p><code><![CDATA[<e n='#' p='#'/>]]></code></p>
<p>Remove <em><strong>n</strong></em> characters before position <em><strong>p</strong></em> in message.</p>
</section4>
<section4 topic="Element &lt;d/&gt; Forward Delete" anchor="element_d_forward_delete">
<p>Support the behavior of Delete key presses, and text block deletes. Text is removed towards end of the message.<br />
<em>Note: Excess deletes MUST be ignored, with text being deleted only to the end of the message in this case.</em></p>
<p><code><![CDATA[<d p='#'/>]]></code></p>
<p>Remove 1 character beginning at position <em><strong>p</strong></em> in message. (<em><strong>n</strong></em> defaults to 1)</p>
<p><code><![CDATA[<d p='#' n='#'/>]]></code></p>
<p>Remove <em><strong>n</strong></em> characters beginning at position <em><strong>p</strong></em> in message.</p>
<p>Remove <em><strong>n</strong></em> characters before character position <em><strong>p</strong></em> in message.</p>
</section4>
<section4 topic="Element &lt;w/&gt; Wait Interval" anchor="element_w_wait_interval">
<p>Allow the transmission of intervals, between real-time text actions, to support the pauses between key presses. See <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>.</p>
<p><code><![CDATA[<w n='#'/>]]></code></p>
<p>Wait <em><strong>n</strong></em> thousandths of a second before processing the next action element. This pause MAY be approximate, and not necessarily be of millisecond precision. The <em><strong>n</strong></em> value SHOULD NOT exceed the <link url="#transmission_interval">Transmission Interval</link>. Also, if a <link url="#body_element">Body Element</link> arrives, pauses SHOULD be interrupted to prevent a delay in message delivery.</p>
</section4>
</section3>
<section3 topic="Accurate Processing of Action Elements" anchor="accurate_processing_of_action_elements">
<p>Real-time text is generated based on text normally allowed to be transmitted within the &lt;body/&gt; element.</p>
<p>Incorrectly generated action elements may lead to inconsistencies between the sender and recipient during real-time editing. The Unicode characters of the real-time text needs to make it transparently from the sender to the recipient, without further Unicode character modifications. This is the chain between the sender's creation of real-time text, to the recipient's processing of real-time text. Transparent transmission of Unicode characters is possible with sender pre-processing, as long as the transmission from the sender to the recipient remains standards-compliant, including compliant XML processors and compliant XMPP servers.</p>
<p>Any inconsistencies that occur during real-time message editing (i.e. non-compliant XMPP server that modifies messages) will recover during the next <link url="#message_reset">Message Reset</link>, and also via <link url="#basic_realtime_text">Basic Real-Time Text</link>.</p>
<section4 topic="Guidelines for Senders" anchor="guidelines_for_senders">
<p>Senders MUST generate real-time text based on the plain text version of the sender's message with all processing already completed. Processing include Unicode normalization, conversion of emoticons graphics to text, removal of illegal characters, line-break conversion, and all other Unicode character modifications. This is done concurrently to the displayed version of the same message (which may continue to have formatting, emoticon graphics, &xep0071;, etc.).</p>
<p>For the purpose of calculating <em><strong>n</strong></em> and <em><strong>p</strong></em> values, line breaks MUST be treated as a single character, if line breaks are used within real-time text. Conversion of line breaks into a single LINE FEED U+000A is REQUIRED for XML processors, according to section 2.11 of <span class="ref"><strong><link url="http://www.w3.org/TR/xml/">XML</link></strong></span> <note>XML: Extensible Markup Language 1.0 (Fifth Edition). &lt;<link url="http://www.w3.org/TR/xml/">http://www.w3.org/TR/xml/</link>&gt;.</note>.</p>
</section4>
<section4 topic="Guidelines for Recipients" anchor="guidelines_for_recipients">
<p>For recipients, <em><strong>p</strong></em> and <em><strong>n</strong></em> are calculated relative to real-time text obtained from a compliant XML processor, before any further Unicode character modifications. Recipients MUST NOT do Unicode normalization (or any other code point modifications) on their copy of the real-time message. This is to allow accurate processing of subsequent action elements (For display purposes, the recipient client can separately process/normalize a copy of the same real-time message text).</p>
<p>Note that <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> is allowed to contain any subset sequence of Unicode characters from the real-time message. This may result in certain situations where the text transmitted in &lt;t/&gt; elements is allowed to be temporarily an incorrectly-formed Unicode string (e.g. incompletely formed glyphs, non-spacing characters, orphaned diacritic character, standalone control character including direction-change character for bidirectional Unicode) but becomes correct when inserted into the middle of the recipient's real-time message, and consequently passes recipient validation/normalization with no character modifications. Note that a compliant XML processor does not modify or fix Unicode errors caused by taking only a subset of characters from correctly-formed Unicode text. One alternative way for implementers to visualize this, is to visualize the Unicode text as an array of individual code points, and treat the <em><strong>p</strong></em> and <em><strong>n</strong></em> values accordingly.</p>
</section4>
<section4 topic="Unicode Character Counting" anchor="unicode_character_counting">
<p>For platform-independent interoperability, calculations of length and position values (<em><strong>p</strong></em> and <em><strong>n</strong></em>) MUST be based on Unicode code points. A single UTF-8 encoded character equals one code point. However, many platforms use different internal encodings (i.e. string formats) that is different from the transmission encoding (UTF-8). Consider these factors:</p>
<ul>
<li><p>Multiple Unicode code points (e.g. combining marks) may combine into one displayable character.<br />
<em>Action elements operate on individual Unicode code points, not on displayable characters.</em></p></li>
<li><p>Unicode code points for characters U+10000 through U+10FFFF are represented as a surrogate pair in some Unicode encodings (e.g. UTF-16).<br />
<em>Action elements operate on individual Unicode code points, not on the separate components of a surrogate pair.</em></p></li>
<li><p>Some Unicode encodings use a variable number of bytes per Unicode code point (e.g. UTF-8).<br /><em>Action elements operate on individual Unicode code points, not on individual bytes.</em></p></li>
</ul>
<p>Incorrectly calculated length and position values (<em><strong>p</strong></em> and <em><strong>n</strong></em>) can result in inconsistencies in the real-time message, such as scrambled text. If this happens, this situation can recover during the <link url="#message_reset">Message Reset</link>.</p>
<p>Length and position values (<em><strong>p</strong></em> and <em><strong>n</strong></em>) are relative to the internal Unicode text of the real-time message, independently of the directionality of actual displayed text. As a result, any valid Unicode text direction can be used with real-time text (right-to-left, left-to-right, and bidirectional).</p>
</section4>
</section3>
</section2>
<section2 topic="Keeping Real-Time Text Synchronized" anchor="keeping_realtime_text_synchronized">
<p>In a chat session, it is important that real-time text stays identical on both the sender and recipient ends. The loss of a single &lt;rtt/&gt; transmission could represent missing text or missing edits. Also, recipients can connect after the sender has already started composing a message. Recovery of in-progress real-time message via <link url="#message_reset">Message Reset</link> is useful in several situations:</p>
<ul>
<li>Resuming after connecting (e.g. wireless reception, recipient restarted software, participants joining).</li>
<li>Resuming after connecting (e.g. wireless reception, recipient started or restarted software).</li>
<li>Resuming after recipient discarded <link url="#stale_messages">Stale Messages</link> (e.g. sender resumes composing hours later).</li>
<li>XMPP servers may drop &lt;message/&gt; elements (e.g. flooding protection).</li>
<li>Multiple <link url="#simultaneous_logins">Simultaneous Logins</link> (e.g. switching systems, switching windows, simultaneous typing).</li>
<li>Resuming after lost message stanzas (e.g. <link url="#congestion_considerations">Congestion Considerations</link>).</li>
<li>During <link url="#simultaneous_logins">Simultaneous Logins</link> (e.g. switching systems, switching windows, simultaneous typing).</li>
<li>During <link url="#multiuser_chat">Multi-User Chat</link> (e.g. participants joining/leaving while other participants are composing).</li>
</ul>
<p>Recipient clients MUST keep track of separate real-time message per sender, including maintaining independent <link url="#seq">seq</link> values. For implementation simplicity, recipient clients MAY track incoming &lt;rtt/&gt; elements per bare JID. Conflicting &lt;rtt/&gt; elements, from separate <link url="#simultaneous_logins">Simultaneous Logins</link>, is handled via the remainder of this section. Alternatively, recipient clients MAY keep track of separate real-time messages per full JID and/or per &lt;thread/&gt;.</p>
<section3 topic="Staying In Sync" anchor="staying_in_sync">
<p>For &lt;rtt/&gt; elements that do not contain an <link url="#event">event</link> attribute:</p>
<ol>
<li>Senders MUST increment the <link url="#seq">seq</link> attribute for consecutively transmitted &lt;rtt/&gt; elements.</li>
<li>Recipients MUST monitor the <link url="#seq">seq</link> attribute value of received &lt;rtt/&gt; elements, to verify that it is incrementing.</li>
<li>Senders MUST increment the <link url="#seq">seq</link> attribute in steps of 1, for consecutively transmitted &lt;rtt/&gt; elements.</li>
<li>Recipients MUST monitor the <link url="#seq">seq</link> attribute value of received &lt;rtt/&gt; elements, to verify that it is incrementing by 1.</li>
</ol>
<p>Recipients MUST keep track of separate real-time messages per sender, including maintaining independent <link url="#seq">seq</link> values. Recipients MAY also use additional methods to distinguish <link url="#simultaneous_logins">Simultaneous Logins</link>, including using the full JID and/or &lt;thread/&gt;.&nbsp;</p>
</section3>
<section3 topic="Recovery From Loss of Sync" anchor="recovery_from_loss_of_sync">
<p>Loss of sync occurs if the <link url="#seq">seq</link> attribute do not increment as expected when <link url="#staying_in_sync">Staying In Sync</link>. In this case:</p>
<p>Loss of sync occurs if the <link url="#seq">seq</link> attribute do not increment by 1 as expected when <link url="#staying_in_sync">Staying In Sync</link>. In this case:</p>
<ul>
<li>Recipients MUST freeze the current real-time message; and</li>
<li>Recipients MUST keep the pre-existing real-time message unchanged; and</li>
<li>Recipients MUST ignore action elements within the current and subsequent &lt;rtt/&gt; elements; and</li>
<li>An indication can be used to show the loss of sync (e.g. color coding, modified chat state message).</li>
</ul>
@ -399,7 +364,7 @@
</section3>
<section3 topic="Message Reset" anchor="message_reset">
<p>A message reset is a retransmission of the sender's partially composed text. The recipient can redisplay the real-time message as a result. It allows real-time text conversation to resume quickly, without waiting for senders to start a new message.</p>
<p>Retransmission SHOULD be done at an average interval of 10 seconds during active typing or composing. This interval is frequent enough to minimize user waiting time, while being infrequent enough to reduce bandwidth overhead. This interval MAY vary in order to reduce average bandwidth requirements for minor message changes and/or for long messages. For quicker recovery, senders MAY adjust the timing of the message retransmissions to occur right after any of the following additional events:&nbsp;</p>
<p>Retransmission SHOULD be done at an average interval of 10 seconds during active typing or composing. This interval is frequent enough to minimize user waiting time, while being infrequent enough to reduce bandwidth overhead. This interval MAY vary to a longer interval, in order to reduce average bandwidth (e.g. long messages, infrequent or minor message changes). For quicker recipient recovery, senders MAY adjust the timing of the message retransmissions to occur right after any of the following additional events:&nbsp;</p>
<ul>
<li>When the recipient starts sending messages from a different full JID (e.g. switched systems);</li>
<li>When the recipient sends a presence update (e.g. from offline to online);</li>
@ -410,7 +375,34 @@
<p><code><![CDATA[<rtt event='reset' seq='#' xmlns='urn:xmpp:rtt:0'>
<t>This is a retransmission of the entire real-time message.</t>
</rtt>]]></code></p>
<p>Note: That there are no restrictions on using multiple <link url="#action_elements">Action Elements</link> during a message reset. (e.g. typing or backspacing occurring at the end of a retransmitted message.)</p>
<p>Note: There are no restrictions on using multiple <link url="#action_elements">Action Elements</link> during a message reset (e.g. typing or backspacing occurring at the end of a retransmitted message).</p>
</section3>
</section2>
<section2 topic="Accurate Processing of Action Elements" anchor="accurate_processing_of_action_elements">
<p>Real-time text is generated based on text normally allowed to be transmitted within the &lt;body/&gt; element.</p>
<p>Incorrectly generated <link url="#action_elements">Action Elements</link> and <link url="#attribute_values">Attribute Values</link> can lead to inconsistencies between the sender and recipient during real-time editing. The Unicode characters of the real-time text needs to make it transparently from the sender to the recipient, without unexpected modifications after sender pre-processing. This is the chain between the sender's creation of real-time text, to the recipient's processing of real-time text. Transparent transmission of Unicode characters is possible with sender pre-processing, as long as the transmission from the sender to the recipient remains standards-compliant, including compliant XML processors and compliant XMPP servers.</p>
<p>Any inconsistencies that occur during real-time message editing (e.g. non-compliant servers that modifies messages, incorrect <link url="#unicode_character_counting">Unicode Character Counting</link>) will recover upon delivery of the <link url="#body_element">Body Element</link>, upon the next <link url="#message_reset">Message Reset</link>, and/or during <link url="#basic_realtime_text">Basic Real-Time Text</link>.</p>
<section3 topic="Unicode Character Counting" anchor="unicode_character_counting">
<p>For this specification, a "character" represents a single Unicode code point. This is the same definition used in section 1.1 of <span class="ref"><strong><link url="http://tools.ietf.org/html/rfc5198">IETF RFC 5198</link></strong></span> <note>RFC 5198: Unicode Format for Network Interchange. &lt;<link url="http://tools.ietf.org/html/rfc5198">http://tools.ietf.org/html/rfc5198</link>&gt;.</note>. For platform-independent interoperability of <link url="#action_elements">Action Elements</link>, calculations on <link url="#attribute_values">Attribute Values</link> (<em><strong>p</strong></em> and <em><strong>n</strong></em>) MUST be based on counts of Unicode code points.</p>
<p>Many platforms use different internal encodings (i.e. string formats) that are different from the transmission encoding (UTF-8). These factors need to be considered:</p>
<ul>
<li><p>Multiple Unicode code points (e.g. combining marks, accents) can form a combining character sequence.<br />
<em>Action elements operate on Unicode code points individually.</em></p></li>
<li><p>Unicode code points U+10000 through U+10FFFF are represented as a surrogate pair in some Unicode encodings (e.g. UTF-16).<br />
<em>Action elements operate on Unicode code points as a whole, not on separate components of a surrogate pair.</em></p></li>
<li><p>XMPP transmission uses UTF-8, which use a variable number of bytes per Unicode code point.<br /><em>Action elements operate on Unicode code points as a whole, not on separate bytes.</em></p></li>
</ul>
<p>Lengths and positions in <link url="#attribute_values">Attribute Values</link> are relative to the internal Unicode text of the real-time message, independently of the directionality of actual displayed text. As a result, any valid Unicode text direction can be used with real-time text (right-to-left, left-to-right, and bidirectional). One way for implementers to visualize this, is to simply visualize Unicode text as an array of individual code points, and treat <link url="#attribute_values">Attribute Values</link> as array indexes.</p>
</section3>
<section3 topic="Guidelines for Senders" anchor="guidelines_for_senders">
<p>Sender clients MUST generate real-time text (<link url="#action_elements">Action Elements</link> and <link url="#attribute_values">Attribute Values</link>) based on the plain text version of the sender's message with pre-processing completed. This is separate and concurrent to any displayed presentation of the same message (e.g. formatting, emoticon graphics, &xep0071;).</p>
<p>Pre-processing before generating real-time text, include Unicode normalization, conversion of emoticons graphics to text, removal of illegal characters, line-break conversion, and any other necessary text modifications. For Unicode normalization, sender clients SHOULD ensure the message is in Unicode Normalization Form C ("NFC"), specified by section 3 of RFC 5198, and within many other standards such as Canonical XML 1.0.</p>
<p>If Unicode combining character sequences (e.g. letter with multiple accents) are used for <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link>, then complete combining character sequences SHOULD be sent. In situations where modifications are required to an existing combining character sequence (e.g. adding an additional accent), an <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link> SHOULD be used to delete the existing combining character sequence, before transmitting a complete replacement sequence via the &lt;t/&gt; element. (However, recipients SHOULD NOT assume this behavior from sending clients. See <link url="#guidelines_for_recipients">Guidelines for Recipients</link>).</p>
<p>For the purpose of calculating <link url="#attribute_values">Attribute Values</link>, line breaks MUST be treated as a single character, if line breaks are used within real-time text. Conversion of line breaks into a single LINE FEED U+000A is REQUIRED for XML processors, according to section 2.11 of <span class="ref"><strong><link url="http://www.w3.org/TR/xml/">XML</link></strong></span> <note>XML: Extensible Markup Language 1.0 (Fifth Edition). &lt;<link url="http://www.w3.org/TR/xml/">http://www.w3.org/TR/xml/</link>&gt;.</note>. In addition, XML character entities are counted as a single character.</p>
</section3>
<section3 topic="Guidelines for Recipients" anchor="guidelines_for_recipients">
<p>For <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link>, text MUST be obtained using compliant XML processing (including entities converted to characters). Recipient clients SHOULD ensure that the received text is in Unicode Normalization Form C ("NFC"). After this, recipient clients MUST NOT do any other modifications to resulting real-time messages. This is to allow accurate processing of subsequent <link url="#action_elements">Action Elements</link> and <link url="#attribute_values">Attribute Values</link> (The recipient client can separately process/modify a copy of the same real-time message text, if necessary for the purpose of display presentation).</p>
<p>It is possible for <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> to contain any subset sequence of Unicode code points from the senders message. This can result in situations where text transmitted in &lt;t/&gt; elements is an incomplete combining character sequence (e.g. Unicode combining mark(s) without a base character) which becomes a complete sequence when inserted within the recipient's real-time message (e.g. additional accent for an existing combining character sequence). These are still complete individual code points, even if the sequence is incomplete.</p>
</section3>
</section2>
</section1>
@ -452,29 +444,29 @@
<p>There are specialized situations such as live transcriptions and captioning (e.g. transcription service, closed captioning provider, captioned telephone, Communication Access Realtime Translation (CART), relay services) that demands low latency transmission. Such systems typically use voice recognition and/or stenotype machines, which output text in word bursts rather than a character at a time. It is acceptable for senders with bursty output to immediately transmit word bursts of text without buffering. This eliminates any lag caused by the <link url="#transmission_interval">Transmission Interval</link>. It is not necessary to transmit <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> for real-time transcription.</p>
</section3>
<section3 topic="Low-Bandwidth and Low-Precision Text Smoothing" anchor="lowbandwidth_and_lowprecision_text_smoothing">
<p>Some software platforms (e.g. JavaScript, BOSH, mobile devices) may have low-precision timers that impact <link url="#transmission_interval">Transmission Interval</link> and/or <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>. Clients can optimize for bandwidth, performance and/or screen repaints by eliminating, merging, or ignoring <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> selectively, especially those containing shorter intervals. In addition, it is acceptable for the transmission interval of &lt;rtt/&gt; to vary, either intentionally for optimizations, or due to precision limitation. &xep0138; can also be used.</p>
<p>Some software platforms (e.g. JavaScript, BOSH, mobile devices) may have low-precision timers that impact <link url="#transmission_interval">Transmission Interval</link> and/or <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>. Clients can optimize for bandwidth, performance and/or screen repaints by eliminating, merging, or ignoring <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> selectively, especially those containing shorter intervals. In addition, it is acceptable for the transmission interval of &lt;rtt/&gt; to vary, either intentionally for optimizations, or due to precision limitation, preferably within the range recommended by <link url="#transmission_interval">Transmission Interval</link>. Compression can also be used to reduce bandwidth (e.g. TLS compression or &xep0138;) .</p>
<p>Clients can choose to implement alternate text-smoothing methods, such as adaptive-rate character-at-a-time output, and/or word buffering for incoming real-time text. Word buffering prevents most typing mistakes from being displayed, which can be a useful mode of operation for certain recipients who may dislike watching the sender's typing mistakes.</p>
</section3>
</section2>
<section2 topic="Activating and Deactivating Real-Time Text" anchor="activating_and_deactivating_realtime_text">
<p>Implementers can choose a preferred activation method for real-time text. For example, clients in the assistive market can choose to do immediate activation of real-time text. Popular mainstream clients might do user-initiated activation/confirmation of real-time text. The confirmation process could be similar to common activation methods used for audio/video. It is also beneficial for senders and recipients to easily synchronize the enabling/disabling of real-time text.</p>
<p>Implementers can choose a preferred activation method for real-time text. For example, clients in the assistive market can choose to do immediate activation of real-time text. Mainstream clients might do user-initiated activation/confirmation of real-time text. The confirmation process could be similar to common activation methods used for audio/video. It is also beneficial for senders and recipients to easily synchronize the enabling/disabling of real-time text.</p>
<section3 topic="Activation Methods" anchor="activation_methods">
<p>Activation of real-time text in a chat session (immediate or user-initiated) can be done by:</p>
<ul>
<li>Immediately transmitting real-time text (if allowed after <link url="#determining_support">Determining Support</link>); or</li>
<li>Signaling first (by transmitting a single &lt;rtt <link url="#event">event</link>='init'/&gt; and waiting for response).</li>
<li>Begin transmitting real-time text (by sending any valid &lt;rtt/&gt; elements); or</li>
<li>Signaling first (by transmitting &lt;rtt <link url="#event">event</link>='init'/&gt; as the first &lt;rtt/&gt; element).</li>
</ul>
<p>Recipient clients can respond to incoming real-time text with an appropriate response, such as:</p>
<p>Recipient clients can respond to any incoming &lt;rtt/&gt; with appropriate response(s), such as any of:</p>
<ul>
<li>Accepting immediately (by activating in response); or</li>
<li>Accepting after recipient confirmation (by also activating in response, after a user confirmation prompt); or</li>
<li>Accepting after recipient confirmation (by activating in response, after a user confirmation prompt); or</li>
<li>Deny (by transmitting &lt;rtt event='cancel'/&gt; which is used in <link url="#deactivation_methods">Deactivation Methods</link>); or</li>
<li>Ignoring (by discarding incoming &lt;rtt/&gt; as a last resort, without using <link url="#deactivation_methods">Deactivation Methods</link>).</li>
<li>Other appropriate responses (e.g. only display incoming real-time text during <link url="#multiuser_chat">Multi-User Chat</link>).</li>
</ul>
<p>If <link url="#determining_support">Determining Support</link> allows, then it is not necessary for senders or recipients to transmit &lt;rtt event='init'/&gt; first, as any incoming <link url="#rtt_element">RTT Element</link> (other than &lt;rtt event='cancel'/&gt;) signals the start of incoming real time text. However, it allows signaling of activation before the sender begins typing.</p>
<p>In the absence of <link url="#determining_support">Determining Support</link>, sender clients can send a single &lt;rtt event='init'/&gt; element to attempt to activate real-time text. It is inappropriate for sender clients to send any further &lt;rtt/&gt; elements unless support is confirmed by discovery, or when the recipient client responds with incoming &lt;rtt/&gt; elements during the same chat session.</p>
<p>It can be acceptable for software to display incoming real-time text without activating outgoing real-time text. Displaying incoming real-time text while waiting for user confirmation, can be educational to users unfamiliar with real-time text. Care needs to be taken to prevent this situation from becoming confusing to the user. Implementers can add other additional behaviors that are appropriate, such as an introductory note upon first activation, for <link url="#privacy">Privacy</link> considerations.</p>
<p>Before transmitting &lt;rtt/&gt; elements, it is preferable for a sender client to explicitly discover whether the recipient client supports the protocol defined herein (using <link url="#determining_support">Determining Support</link>). Once confirmed, it is useful for sender clients to signal activation using &lt;rtt event=init/&gt;, since it may be a while before the user starts to compose a new message.</p>
<p>In the absence of explicit discovery or negotiation, the sender client can implicitly request and discover the use of real-time text, by sending &lt;rtt event='init'/&gt; upon activation. It is inappropriate to send any further &lt;rtt/&gt; elements, until the recipient client responds with incoming &lt;rtt/&gt; elements during the same chat session. Implicit discovery allows usage of real-time text as an enhancement to &xep0085; (XEP-0085 Section 5.1), during all situations where it can be used. See <link url="#usage_with_chat_states">Usage with Chat States</link>.</p>
<p>It can be acceptable for software to display incoming real-time text without activating outgoing real-time text. Displaying incoming real-time text, while waiting for user confirmation, can be educational to users unfamiliar with real-time text. Care needs to be taken to prevent this situation from becoming confusing to the user. Implementers can add other additional behaviors that are appropriate, such as an introductory note upon first activation, for <link url="#privacy">Privacy</link> considerations.</p>
</section3>
<section3 topic="Deactivation Methods" anchor="deactivation_methods">
<p>Real-time text can be deactivated by any of:</p>
@ -482,7 +474,7 @@
<li>Sending a signal (using &lt;rtt <link url="#event">event</link>='cancel'/&gt; upon deactivation, deny, or end of chat session); or</li>
<li>Simply ending the chat session (without transmitting any further &lt;rtt/&gt; elements).</li>
</ul>
<p>Recipient clients can respond to deactivation with appropriate responses, such as:</p>
<p>Recipient clients can respond to deactivation with appropriate response(s), including:</p>
<ul>
<li>Discontinue transmission of &lt;rtt/&gt; elements as well (not applicable to <link url="#multiuser_chat">Multi-User Chat</link>); and</li>
<li>Handle the sender's unfinished incoming real-time message (such as clearing it and/or saving it); and</li>
@ -493,16 +485,14 @@
</section2>
<section2 topic="Optional Remote Cursor" anchor="optional_remote_cursor">
<p>Recipient clients might choose to display a cursor (or caret) within incoming real-time messages. This enhances usability of real-time text further, since it becomes easier for a recipient to observe the sender's real-time message edits.</p>
<p>If a remote cursor is not used, then clients can simply ignore calculating a cursor position and skip this section. All action elements only have absolute positioning, and positioning does not depend on previous action elements, so clients do not need to remember the previous cursor position.</p>
<p>If a remote cursor is not used, then clients can simply ignore calculating a cursor position and skip this section. <link url="#action_elements">Action Elements</link> only use absolute positioning (relative positions are not used by this standard), so clients do not need to remember the position value from previous action elements.</p>
<section3 topic="Calculating Cursor Position" anchor="calculating_cursor_position">
<p>When &lt;t/&gt;, &lt;e/&gt;, or &lt;d/&gt; action elements are processed in incoming real-time text, the beginning value for the cursor position calculation is the absolute position value of the <em><strong>p</strong></em> attribute, according to <link url="#summary_of_attribute_values">Summary of Attribute Values</link>. The recipient can calculate the cursor position as follows:</p>
<p>When &lt;t/&gt; or &lt;e/&gt; action elements are processed in incoming real-time text, the beginning value for the cursor position calculation is the absolute position value of the <em><strong>p</strong></em> attribute, according to <link url="#attribute_values">Attribute Values</link>. The recipient can calculate the cursor position as follows:</p>
<ul>
<li><p>After <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link>, the cursor position is the <em><strong>p</strong></em> attribute plus the length of the text being inserted. The cursor position is put at the end of inserted text.<br />
<li><p>After <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link>, the cursor position is the <em><strong>p</strong></em> attribute plus the length of the text being inserted. The cursor position is put at the end of the inserted text.<br />
<em>This is the normal forward cursor movement during text insertion.</em></p></li>
<li><p>After <link url="#element_e_backspace">Element &lt;e/&gt; Backspace</link>, the cursor position is the <em><strong>p</strong></em> attribute minus the <em><strong>n</strong></em> attribute.<br />
<li><p>After <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link>, the cursor position is the <em><strong>p</strong></em> attribute minus the <em><strong>n</strong></em> attribute.<br />
<em>This is the normal backwards cursor movement to a Backspace key.</em></p></li>
<li><p>After <link url="#element_d_forward_delete">Element &lt;d/&gt; Forward Delete</link>, the cursor position is the <em><strong>p</strong></em> attribute, unaffected by the <em><strong>n</strong></em> attribute.<br />
<em>This is the normal stationary cursor response to a Delete key.</em></p></li>
<li><p>After an empty <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> (in the format of <strong>&lt;t p='#'/&gt;</strong> with no text to insert), the cursor position is the <strong>p</strong> attribute, and no text modification is done.<br />
<em>This allows cursor response to arrow keys and/or mouse repositioning the cursor.</em></p></li>
</ul>
@ -522,10 +512,10 @@
<li>It makes no assumptions about different keyboards or input method editors (e.g. Chinese).</li>
<li>Text change events are more portable across platforms, including on mobile phones.</li>
</ul>
<p>During a text change event, the senders current message text can be compared to the old message text (from before the text change event). In order to calculate what text changes took place, the first changed character and the last changed character is determined. From this, it is possible to generate <link url="#action_elements">Action Elements</link> for any text insertion and deletions. In addition, if <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> is supported, then <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> records the time elapsed between text change events.</p>
<p>During a text change event, the senders current message text can be compared to the old message text from the previous text change event. The difference in text, between consecutive text change events, is typically a one character difference (e.g. key press) or one text block difference (e.g. auto-correct, cut, paste). In order to calculate what text changes took place, the first changed character and the last changed character is determined. From this, it is simple to generate <link url="#action_elements">Action Elements</link> for a single text block deletion and/or insertion. In addition, if <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> is supported, then <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> records the time elapsed between text change events.</p>
<p>Sender software can do the following:</p>
<ol>
<li><p>Monitor for text changes in the senders message. Whenever a text change event occurs, compute action elements and append these action elements to a buffer. This is equivalent to recording a small sequence of typing.</p></li>
<li><p>Monitor for text changes in the senders message. Whenever a text change event occurs, compute action element(s) and append these action element(s) to a buffer. Repeating this step during every text change event, is equivalent to recording a small sequence of typing.</p></li>
<li><p>During every <link url="#transmission_interval">Transmission Interval</link>, all buffered action elements are transmitted in &lt;rtt/&gt; element in a &lt;message/&gt; stanza. This is equivalent to transmitting a small sequence of typing at a time.</p></li>
<li><p>If there are no message changes occurring, no unnecessary transmission takes place.</p></li>
</ol>
@ -534,7 +524,7 @@
<p>Real-time text can be generated via monitoring key presses. However, this does not have the advantages of <link url="#monitoring_message_changes_instead_of_key_presses">Monitoring Message Changes Instead Of Key Presses</link>. Care needs be taken with automatic changes to the message, generated by means other than key presses. This includes spell check auto-correct, copy and pastes, transcription, input method editors, and multiple key presses required to compose a character (i.e. accents). Key press events do not capture these text changes, and this can cause real-time text to go out of sync between the sender and the recipient.</p>
</section3>
<section3 topic="Basic Real-Time Text" anchor="basic_realtime_text">
<p>Sender clients may choose to implement <link url="#message_reset">Message Reset</link> as the only method of transmitting changes to real-time message. The entire message is simply retransmitted every <link url="#transmission_interval">Transmission Interval</link> whenever there are any text changes. The below is a transmission of the real-time message “<strong>Hello there!</strong>” at regular intervals while the sender is typing.</p>
<p>It is possible for sender clients to implement <link url="#message_reset">Message Reset</link> as the only method of transmitting changes to a real-time message. This method of sending real-time text is generally discouraged in most general-use clients. The entire message is simply retransmitted every <link url="#transmission_interval">Transmission Interval</link> whenever there are any text changes. The below is a transmission of the real-time message “<strong>Hello there!</strong>” at regular intervals while the sender is typing.</p>
<p><code><![CDATA[<message to='bob@example.com' from='alice@example.com/home' type='chat' id='a01'>
<rtt xmlns='urn:xmpp:rtt:0' seq='123001' event='new'>
<t>Hel</t>
@ -552,31 +542,30 @@
<t>Hello there!</t>
</rtt>
</message>]]></code></p>
<p>The advantage is very simple implementation. However, disadvantages include the lack of <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>, and extra bandwidth consumption that can occur with longer messages, unless stream compression is used.</p>
<p>The advantage is very simple implementation. However, major disadvantages include the lack of <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>, and extra bandwidth consumption that can occur with longer messages, unless stream compression is used.</p>
</section3>
<section3 topic="Append-Only Real-Time Text" anchor="appendonly_realtime_text">
<p>The use of <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> without any attributes, simply appends text to the end of a message, while the use of <link url="#element_e_backspace">Element &lt;e/&gt; Backspace</link> without any attributes, simply erases text from the end of the message. These simple action elements are useful if mid-message editing capabilities are not used (e.g. simple transcription, news tickers, relay services, captioned telephone).</p>
<p>If editing is needed in the middle of a message, without adding sender support for other <link url="#action_elements">Action Elements</link>, the use of <link url="#message_reset">Message Reset</link> supports situations where mid-message editing takes place. In this situation, the disadvantages include the lack of <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>, and extra bandwidth consumption that can occur with longer messages, unless stream compression is used.</p>
<p>The use of <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> without any attributes, simply appends text to the end of a message, while the use of <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link> without any attributes, simply erases text from the end of the message. This sending method is unsuitable for most general-purpose clients, but is useful if mid-message editing capabilities are not used (e.g. simple transcription, news tickers, relay services, captioned telephone).</p>
<p>If editing is needed in the middle of a message, without adding sender support for other <link url="#action_elements">Action Elements</link>, the use of <link url="#message_reset">Message Reset</link> supports situations where mid-message editing takes place. In this situation, the disadvantages are the same as <link url="#basic_realtime_text">Basic Real-Time Text</link>, including the lack of <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>, and extra bandwidth consumption that can occur with longer messages, unless stream compression is used.</p>
</section3>
</section2>
<section2 topic="Receiving Real-Time Text" anchor="receiving_realtime_text">
<p>In order to allow <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> in incoming real-time text, recipient clients can do the following:</p>
<ol>
<li><p>Upon receiving <link url="#action_elements">Action Elements</link> in incoming &lt;rtt/&gt; elements, they are added to a queue in the order they are received. This provides immunity to variable network conditions, since the queueing action smooth out the latency fluctuations of incoming transmission.</p></li>
<li><p>Upon receiving <link url="#action_elements">Action Elements</link> in incoming &lt;rtt/&gt; elements, they are added to a queue in the order they are received. This provides immunity to variable network conditions, since the queuing action will smooth out incoming transmission (e.g. receiving new &lt;rtt/&gt; while still processing a delayed &lt;rtt/&gt;).</p></li>
<li><p>The recipient client processes action elements in the queue in sequential order, including pauses from <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link>. This is equivalent to playing back the sender's original typing.</p></li>
<li><p>Upon receiving a <link url="#body_element">Body Element</link> indicating a completed message, the full message text from &lt;body/&gt; can be displayed immediately in place of the real-time message, and unprocessed action elements can be cleared from the queue. This ensures final message delivery is not delayed by late processing of action elements.</p></li>
</ol>
<p>In processing <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link>, excess lag in incoming real-time text might occur if multiple delayed &lt;rtt/&gt; elements suddenly get delivered (e.g. congestion, intermittent wireless reception). Recipients can avoid excess lag by monitoring the queue for excess &lt;w/&gt; action elements (e.g. unprocessed &lt;w/&gt; elements from two &lt;rtt/&gt; elements ago) and then ignoring or shortening the intervals in &lt;w/&gt; elements. This allows lagged real-time text to "catch up" more quickly. In addition, it is best to process &lt;w/&gt; elements using non-blocking programming techniques.</p>
<p>In processing <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link>, excess lag in incoming real-time text might occur if multiple delayed &lt;rtt/&gt; elements suddenly get delivered (e.g. congestion, intermittent wireless reception). Recipients can avoid excess lag by monitoring the queue for excess &lt;w/&gt; action elements (e.g. unprocessed &lt;w/&gt; elements from two &lt;rtt/&gt; elements ago) and then ignoring or shortening the intervals in &lt;w/&gt; elements. This allows lagged real-time text to "catch up" more quickly.</p>
</section2>
<section2 topic="Other Guidelines" anchor="other_guidelines">
<p><link name="_Hlk168620696"></link>There are other special basic considerations for real-time message transmissions that need to be considered by implementers.</p>
<section3 topic="Message Length" anchor="message_length">
<p>A large sequence of action elements can result in an &lt;rtt/&gt; larger than the size of a message &lt;body/&gt;. This can occur normally during fast typing when <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> during small messages. However, if the &lt;rtt/&gt; element becomes unusually huge (e.g. macros, multiple copy and pastes, leading to an &lt;rtt/&gt; exceeding one kilobyte) a <link url="#message_reset">Message Reset</link> can instead be used, in order to save bandwidth. (Stream compression is another approach.)</p>
<p>Clients can limit the length of the text input for the sender's message, in order to keep the size of &lt;message/&gt; stanzas reasonable, including during <link url="#message_reset">Message Reset</link>. Also, large &lt;rtt/&gt; elements may occur in situations such as large copy and pastes. To keep message stanza sizes reasonable, &lt;rtt/&gt; can be transmitted in a separate &lt;message/&gt; than the one containing &lt;body/&gt;.</p>
<p>For specialized clients that send continuous real-time text (e.g. news ticker, captioning, transcription, TTY gateway), a <link url="#body_element">Body Element</link> can be automatically sent when messages reach a certain length. This allows continuous real-time text without real-time messages becoming excessively large.</p>
<p>For specialized clients that send continuous real-time text (e.g. news ticker, captioning, transcription, TTY gateway), a <link url="#body_element">Body Element</link> can be sent and then a new real-time message started immediately after, every time a message reaches a reasonable size. This allows continuous real-time text without real-time messages becoming excessively large.</p>
</section3>
<section3 topic="Usage with Chat States" anchor="usage_with_chat_states">
<p>Real-time text can be used in conjunction with XEP-0085 &xep0085;. These are simple guidelines for &lt;message/&gt; stanzas that include an &lt;rtt/&gt; element:</p>
<p>Real-time text can be used in conjunction with XEP-0085 Chat States. These are simple guidelines for &lt;message/&gt; stanzas that include an &lt;rtt/&gt; element:</p>
<ul>
<li>For &lt;rtt/&gt; transmitted without an accompanying &lt;body/&gt;, include &lt;composing/&gt; chat state.</li>
<li>For &lt;rtt/&gt; transmitted with an accompanying &lt;body/&gt;, include the &lt;active/&gt; chat state.</li>
@ -600,19 +589,15 @@
<p>Senders that resume composing a message (i.e. continues a partially-composed message hours later) can transmit a <link url="#message_reset">Message Reset</link>, which allows recipients to redisplay the real-time message.</p>
</section3>
<section3 topic="Performance &amp; Efficiency" anchor="performance_efficiency">
<p>With real-time text, frequent screen updates can occur. Screen updates are a potential performance bottleneck, since fast typists type many key presses per second. Optimizing screen updates becomes especially important for slower platforms. Real-time messages need to be redisplayed efficiently in a flicker-free manner. The real-time message might be implemented as a separate window or separate display element.</p>
<p>With real-time text, frequent screen updates can occur. Screen updates are a potential performance bottleneck, since fast typists type many key presses per second. Optimizing screen updates becomes especially important for slower platforms. The real-time message might be implemented as a separate window or separate display element.</p>
<p>Battery life considerations are closely related to performance, as the addition of real-time text may impact battery life. If <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> are supported, then the implementation of <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> needs to be implemented in a battery-efficient manner. The <link url="#transmission_interval">Transmission Interval</link> may vary dynamically to optimize for battery life and wireless reception. For devices where screen updates are an unavoidable inefficient bottleneck, see <link url="#lowbandwidth_and_lowprecision_text_smoothing">Low-Bandwidth and Low-Precision Text Smoothing</link> to reduce the number of screen updates per second.</p>
</section3>
<section3 topic="Total Conversation Combination with Audio and Video" anchor="total_conversation_combination_with_audio_and_video">
<p>According to ITU-T Rec. F.703, the “Total Conversation” accessibility standard defines the simultaneous use of audio, video, and real-time text. For convenience, messaging applications may be designed to have automatic negotiation of as many as possible of the three media preferred by the users.</p>
<p>In the XMPP session environment, the Jingle protocol (&xep0166;) is available for negotiation and transport of the more time-critical, real-time audio and video media. Any combination of audio, video, and real-time text can be used together simultaneously.</p>
</section3>
</section2>
</section1>
<section1 topic="Use Cases" anchor="use_cases">
<p>Most of these examples are deliberately kept simple. In complete software implementations supporting key press intervals, transmissions will most resemble the last example, <link url="#full_message_including_key_press_intervals">Full Message Including Key Press Intervals</link>.</p>
<section2 topic="Example of Simple Real Time Text" anchor="example_of_simple_real_time_text">
<p>All three examples shown below result in the same real-time message "<strong>HELLO</strong>" created by writing "<strong>HLL</strong>", backspacing two times, and then "<strong>ELLO</strong>". The action elements are <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> and <link url="#element_e_backspace">Element &lt;e/&gt; Backspace</link>.</p>
<p>Most of these examples are deliberately kept simple. In complete software implementations supporting key press intervals, transmissions will most resemble the last example, <link url="#full_message_including_key_press_intervals">Full Message Including Key Press Intervals</link>. For simplicity, these examples use a bare JID, even in situations where a full JID might be more appropriate.</p>
<section2 topic="Example of Simple Real-Time Text" anchor="example_of_simple_realtime_text">
<p>All three examples shown below result in the same real-time message "<strong>HELLO</strong>" created by writing "<strong>HLL</strong>", backspacing two times, and then "<strong>ELLO</strong>". The action elements are <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link> and <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link>.</p>
<p><code><![CDATA[<message to='bob@example.com' from='alice@example.com/home' type='chat' id='a01'>
<rtt xmlns='urn:xmpp:rtt:0' seq='123001' event='new'>
<t>HLL</t>
@ -722,25 +707,25 @@
<ul>
<li>The <strong><link url="#event">event</link></strong> attribute equals 'new' for the start of every new message.</li>
<li>The <strong><link url="#seq">seq</link></strong> attribute increments within the same message.</li>
<li>The <strong><link url="#seq">seq</link></strong> attribute randomizes when beginning of a new message.</li>
<li>The <strong><link url="#seq">seq</link></strong> attribute randomizes when beginning a new message.</li>
<li>This shows <link url="#usage_with_chat_states">Usage with Chat States</link>.</li>
</ul>
</section2>
<section2 topic="Examples of Message Edits" anchor="examples_of_message_edits">
<p>These examples illustrate real-time message editing via <link url="#action_elements">Action Elements</link>.<br />
Note: In most situations, during normal human typing speeds at a normal <link url="#transmission_interval">Transmission Interval</link>, smaller fragments of text will be spread over multiple &lt;rtt/&gt;, than these demonstration &lt;rtt/&gt; examples below. See <link url="#sending_realtime_text">Sending Real-Time Text</link>.</p>
Note: In most situations, during normal human typing speeds at a normal <link url="#transmission_interval">Transmission Interval</link>, smaller fragments of text will be spread over multiple &lt;rtt/&gt; elements, than these demonstration examples below. See <link url="#sending_realtime_text">Sending Real-Time Text</link>.</p>
<section3 topic="Deleting Text From Message" anchor="deleting_text_from_message">
<p><code><![CDATA[<message to='bob@example.com' from='alice@example.com/home' type='chat' id='a01'>
<rtt xmlns='urn:xmpp:rtt:0' seq='123001' event='new'>
<t>Hello Bob, this is Alice!</t>
<d n='4' p='5'/>
<e n='4' p='9'/>
</rtt>
</message>]]></code></p>
<p>Final result of real-time message: "<strong>Hello, this is Alice!</strong>"<br />
This example outputs "<strong>Hello Bob, this is Alice!</strong>" then <strong>&lt;d n='4' p='5'/&gt;</strong> deletes 4 characters from position 5. The <link url="#element_d_forward_delete">Element &lt;d/&gt; Forward Delete</link> removes the text " <strong>Bob</strong>" including the preceding space character.</p>
This example outputs "<strong>Hello Bob, this is Alice!</strong>" then <strong>&lt;e n='4' p='9'/&gt;</strong> erases 4 characters before character position index 9. The <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link> removes the text " <strong>Bob</strong>" including the preceding space character.</p>
</section3>
<section3 topic="Inserting Text Into Message" anchor="inserting_text_into_message">
@ -762,7 +747,7 @@
<p><code><![CDATA[<message to='bob@example.com' from='alice@example.com/home' type='chat' id='a01'>
<rtt xmlns='urn:xmpp:rtt:0' seq='123001' event='new'>
<t>Hello Bob, tihsd is Alice!</t>
<d p='11' n='5'/>
<e p='16' n='5'/>
<t p='11'>this</t>
</rtt>
</message>]]></code></p>
@ -770,7 +755,7 @@
<p>Final result of real-time message: "<strong>Hello Bob, this is Alice!</strong>"<br />
This example outputs "<strong>Hello Bob, tihsd is Alice!</strong>", then <strong>&lt;d p='11' n='5'/&gt;</strong> deletes 5 characters at position 11 in the string of text (which erases the mistyped word "<strong>tihsd</strong>"). Finally, <strong>&lt;t p='11'&gt;this&lt;/t&gt;</strong> inserts the text "<strong>this</strong>" place of the original misspelled word.</p>
This example outputs "<strong>Hello Bob, tihsd is Alice!</strong>", then <strong>&lt;e p='16' n='5'/&gt;</strong> erases 5 characters at position 16 in the string of text (which erases the mistyped word "<strong>tihsd</strong>"). Finally, <strong>&lt;t p='11'&gt;this&lt;/t&gt;</strong> inserts the text "<strong>this</strong>" place of the original misspelled word.</p>
</section3>
<section3 topic="Multiple Message Edits" anchor="multiple_message_edits">
<p>This is an example message containing multiple consecutive real-time message edits. This illustrates valid use of the &lt;rtt/&gt; element.</p>
@ -781,7 +766,7 @@
<t>lo...planet</t>
<e n='6'/>
<t> World</t>
<d n='3' p='5'/>
<e n='3' p='8'/>
<t p='5'> there,</t>
</rtt>
</message>]]></code></p>
@ -804,7 +789,7 @@
</tr>
<tr>
<td>&lt;e/&gt;</td>
<td>Backspace&nbsp;1&nbsp;character&nbsp;from&nbsp;end&nbsp;of&nbsp;line.</td>
<td>Erase&nbsp;1&nbsp;character&nbsp;from&nbsp;end&nbsp;of&nbsp;line.</td>
<td>Hel</td>
<td>3</td>
</tr>
@ -816,7 +801,7 @@
</tr>
<tr>
<td>&lt;e&nbsp;n='6'/&gt;</td>
<td>Backspace&nbsp;6&nbsp;characters&nbsp;from&nbsp;end&nbsp;of&nbsp;line</td>
<td>Erase&nbsp;6&nbsp;characters&nbsp;from&nbsp;end&nbsp;of&nbsp;line</td>
<td>Hello...</td>
<td>8</td>
</tr>
@ -827,8 +812,8 @@
<td>14</td>
</tr>
<tr>
<td>&lt;d&nbsp;n='3'&nbsp;p='5'/&gt;</td>
<td>Delete&nbsp;3&nbsp;characters&nbsp;at&nbsp;position&nbsp;5</td>
<td>&lt;e&nbsp;n='3'&nbsp;p='8'/&gt;</td>
<td>Erase&nbsp;3&nbsp;characters&nbsp;before&nbsp;position&nbsp;8</td>
<td>Hello&nbsp;World</td>
<td>5</td>
</tr>
@ -840,7 +825,7 @@
</tr>
</table>
<p>*The Cursor Position column is only relevant if the <link url="#optional_remote_cursor">Optional Remote Cursor</link> is implemented.</p>
<p>This example does not illustrate <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>. Also, it is noted that most situations, during normal typing speeds at a normal <link url="#transmission_interval">Transmission Interval</link>, the series of <link url="#action_elements">Action Elements</link> will typically be spread over multiple separate &lt;rtt/&gt; elements.</p>
<p>This example does not illustrate <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>. Also, it is noted that most situations, during normal typing speeds at a normal <link url="#transmission_interval">Transmission Interval</link>, the above series of <link url="#action_elements">Action Elements</link> will normally be spread over multiple separate &lt;rtt/&gt; elements.</p>
</section3>
</section2>
<section2 topic="Examples of Key Press Intervals" anchor="examples_of_key_press_intervals">
@ -937,49 +922,52 @@
<p>This example also illustrates the following:</p>
<ul>
<li>Typing is done via <link url="#element_t_insert_text">Element &lt;t/&gt; Insert Text</link>.</li>
<li>Backspaces are done via <link url="#element_e_backspace">Element &lt;e/&gt; Backspace</link>.</li>
<li>Backspaces are done via <link url="#element_e_erase_text">Element &lt;e/&gt; Erase Text</link>.</li>
<li>There is a final transmission with a <link url="#body_element">Body Element</link>, when the message is finished.</li>
<li>Intervals between key presses are done via <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link>.</li>
<li>Each &lt;message/&gt; is delivered at a regular <link url="#transmission_interval">Transmission Interval</link>, typically 0.7 seconds.</li>
<li>Cursor movements via empty &lt;t/&gt; elements. Sender transmission is not essential, but can be desirable for recipient clients supporting an <link url="#optional_remote_cursor">Optional Remote Cursor</link>.</li>
<li>Recipient clients that do not support <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link> and/or <link url="#optional_remote_cursor">Optional Remote Cursor</link>, will still display this message normally.</li>
<li>The total sum of all values in <link url="#element_w_wait_interval">Element &lt;w/&gt; Wait Interval</link> in one &lt;message/&gt; equal the <link url="#transmission_interval">Transmission Interval</link> during periods of continuous typing. This also results in some &lt;w/&gt; interval elements being split between consecutive messages. Although not critical, it can further improve the fluidity of <link url="#receiving_realtime_text">Receiving Real-Time Text</link>.</li>
<li>See <link url="#monitoring_message_changes_instead_of_key_presses">Monitoring Message Changes Instead Of Key Presses</link> for more info.</li>
<li>See <link url="#monitoring_message_changes_instead_of_key_presses">Monitoring Message Changes Instead Of Key Presses</link> for the best method of implementation.</li>
</ul>
</section3>
</section2>
</section1>
<section1 topic="Interoperability Considerations" anchor="interoperability_considerations">
<p>There are other real-time text formats with interoperability considerations relating to the session setup level, the media transport level, and presentation level. Interoperability specifications between multiple real-time text formats can be found in the Interoperability section of <span class="ref"><strong><link url="http://www.realtimetext.org">Real-Time Text Taskforce</link></strong></span>
<note>Real-Time Text Taskforce, a foundation for real-time text standardization &lt;<link url="http://www.realtimetext.org">http://www.realtimetext.org</link>&gt;.</note>.</p>
<p>It is appropriate for implementers to choose the most appropriate real-time text standard for the session control standard in use during a particular session. Clients that use XMPP (e.g. Google Talk) would utilize this XEP-0301 specification. Clients that use SIP can utilize IETF RFC 4103, <span class="ref"><strong><link url="http://tools.ietf.org/html/rfc5194">IETF RFC 5194</link></strong></span> <note>IETF RFC 5194: Framework for Real-Time Text over IP Using the Session Initiation Protocol (SIP). &lt;<link url="http://tools.ietf.org/html/rfc5194">http://tools.ietf.org/html/rfc5194</link>&gt;.</note> and ITU-T T.140. Clients that run on multiple networks, may need to utilize multiple real-time text standards. To interoperate between incompatible real-time text standards, gateway servers can transcode between different real-time text standards, along with other media such as audio and video. This can include TTY and textphones. Also, see <link url="#total_conversation_combination_with_audio_and_video">Total Conversation Combination with Audio and Video</link>.</p>
<p>There are other real-time text formats with interoperability considerations relating to the session setup level, the media transport level, and presentation level. Interoperability specifications between multiple real-time text formats can be found at Real-Time Text Taskforce (R3TF).</p>
<p>It is appropriate for implementers to choose the most appropriate real-time text standard for the session control standard in use during a particular session. For example, clients that use XMPP can utilize this XEP-0301 specification, and clients that use SIP might utilize IETF RFC 4103, <span class="ref"><strong><link url="http://tools.ietf.org/html/rfc5194">IETF RFC 5194</link></strong></span> <note>RFC 5194: Framework for Real-Time Text over IP Using the Session Initiation Protocol (SIP). &lt;<link url="http://tools.ietf.org/html/rfc5194">http://tools.ietf.org/html/rfc5194</link>&gt;.</note> and ITU-T T.140). Clients that run on multiple networks, might need to utilize multiple real-time text standards. To interoperate between incompatible real-time text standards, gateway servers can transcode between different real-time text standards, along with other media such as audio and video. This can include TTY and textphones.</p>
<section2 topic="RFC 4103 and T.140" anchor="rfc_4103_and_t140">
<p>In the SIP environment, real-time text is specified in IETF RFC 4103 and ITU-T T.140. SIP is a popular real-time session control protocol, and there are many implementations of real-time text controlled by SIP. This includes some emergency service organizations (e.g. Reach 112).</p>
<p>In the SIP environment, real-time text is specified in IETF RFC 4103 and ITU-T T.140. SIP is a popular real-time session control protocol, and there are many implementations of real-time text controlled by SIP. This includes emergency services in some regions.</p>
<p>Interoperability considerations include addressing translation, media negotiation and translation, and media transcoding. Transcoding is straightforward between this specification and T.140/RFC4103, except for editing in the middle of messages. Text insertions or deletions, occurring far back in the message, can cause a large number of erase operations in T.140 that consume time and bandwidth. T.140 specifies the use of ISO 6429 control codes for presentation characteristics, such as text color, that are not supported by this specification. During transcoding, these control codes needs to be filtered off in order to not disturb the presentation of text.</p>
</section2>
<section2 topic="Total Conversation Combination with Audio and Video" anchor="total_conversation_combination_with_audio_and_video">
<p>According to ITU-T Rec. F.703, the “Total Conversation” accessibility standard defines the simultaneous use of audio, video, and real-time text. This is more widespread in certain regions (e.g. Reach 112 in Europe). For convenience, messaging applications can be designed to have automatic negotiation of as many as possible of the three media preferred by the users.</p>
<p>In the XMPP session environment, the Jingle protocol (&xep0166;) is available for negotiation and transport of the more time-critical, real-time audio and video media. Any combination of audio, video, and real-time text can be used together simultaneously.</p>
</section2>
</section1>
<section1 topic="Internationalization Considerations" anchor="internationalization_considerations">
<p>The primary internationalization consideration involve real-time message editing via <link url="#action_elements">Action Elements</link>, where text is inserted and deleted using index and position values. In particular, correct <link url="#unicode_character_counting">Unicode Character Counting</link> needs to be followed, due to the existence of variable-length encodings and right-to-left text. Also, <link url="#accurate_processing_of_action_elements">Accurate Processing of Action Elements</link> will ensure that all possible valid Unicode text can be used via this protocol. This can include text containing multiple scripts/languages, ideographic symbols (e.g. Chinese), right-to-left text (e.g. Arabic), and bidirectional text.</p>
<p>The primary internationalization consideration involve real-time message editing using <link url="#action_elements">Action Elements</link>, where text is inserted and deleted using position and length values. For this, <link url="#accurate_processing_of_action_elements">Accurate Processing of Action Elements</link> including correct <link url="#unicode_character_counting">Unicode Character Counting</link> will ensure that all possible valid Unicode text can be used via this protocol. This includes text containing multiple scripts/languages, ideographic symbols (e.g. Chinese), right-to-left text (e.g. Arabic), and bidirectional text.</p>
<p>For accessibility considerations, there is an <span class="ref"><strong><link url="http://www.fasttext.org">International Symbol of Real-Time Text</link></strong></span>
<note>The International Symbol of Real-Time Text &lt;<link url="http://www.fasttext.org">http://www.fasttext.org</link>&gt;.</note> to alert users to the existence of this feature.</p>
</section1>
<section1 topic="Security Considerations" anchor="security_considerations">
<section2 topic="Privacy" anchor="privacy">
<p>It is important for implementers of real-time text to educate users about real-time text. Users of real-time text needs to be aware that their typing is now visible in real-time to everyone in the current chat conversation. This may have security implications if users copy &amp; paste private information into their chat entry buffer (e.g. a shopping invoice) before editing out the private parts of the pasted text (e.g. a credit card number) before they send the message. With real-time message editing, recipients can watch all text changes that occur in the sender's text, before the sender sends the final message. Implementation behaviors and improved education can be added to reduce privacy issues. Examples include showing an introduction upon first activation of feature, special handling for copy and pastes (i.e. preventing them, or prompting for confirmation), recipient confirmation of real-time text via <link url="#activating_and_deactivating_realtime_text">Activating and Deactivating Real-Time Text</link>, etc.</p>
<p>It is important for users to be made aware of real-time text (e.g. user consent, software notice, introductory explanation). Users of real-time text needs to be aware that their typing is now visible in real-time to everyone in the current chat conversation. This may have security implications if users copy &amp; paste private information into their chat entry buffer (e.g. a shopping invoice) before editing out the private parts of the pasted text (e.g. a credit card number) before they send the message. With real-time message editing, recipients can watch all text changes that occur in the sender's text, before the sender finishes the message. Implementation behaviors and improved education can be added to reduce privacy issues. Examples include showing an introduction upon first activation of feature, special handling for copy and pastes (i.e. preventing them, or prompting for confirmation), recipient confirmation of real-time text via <link url="#activating_and_deactivating_realtime_text">Activating and Deactivating Real-Time Text</link>, etc.</p>
</section2>
<section2 topic="Encryption" anchor="encryption">
<p>Real-time text (&lt;rtt/&gt; elements) transmit the content contained within messages. Therefore, a client that encrypts &lt;body/&gt;, also needs to also encrypt &lt;rtt/&gt; as well:</p>
<p>Real-time text (&lt;rtt/&gt; elements) transmit the content contained within messages. Therefore, a client that encrypts &lt;body/&gt; also needs to encrypt &lt;rtt/&gt; as well:</p>
<ul>
<li><p>Encryption at the stream level (e.g. TLS) can be used normally with this specification. Stream-level encryption is the most common form of encryption.</p></li>
<li><p>Encryption at the &lt;message/&gt; stanza level (e.g. deferred XEP-0200) can be used for all stanzas containing either &lt;rtt/&gt; or &lt;body/&gt;. It is worth noting that stanza-level encryption produces significantly more overhead, due to the increased number of stanzas that real-time text causes, leading to <link url="#congestion_considerations">Congestion Considerations</link>.</p></li>
<li><p>Encryption at the &lt;message/&gt; stanza level (e.g. XEP-0200) can be used for all stanzas containing either &lt;rtt/&gt; or &lt;body/&gt;. It is noted that real-time text can have a higher rate of message stanzas, contributing to additional overhead. See <link url="#congestion_considerations">Congestion Considerations</link>.</p></li>
<li><p>Encryption at the &lt;body/&gt; level (e.g. deprecated XEP-0027) do not encrypt &lt;rtt/&gt;. In this case, &lt;rtt/&gt; needs to be encrypted separately. It is preferable to use a broader level of encryption, where possible.</p></li>
</ul>
</section2>
<section2 topic="Congestion Considerations" anchor="congestion_considerations">
<p>The nature of real-time text result in more frequent transmission of &lt;message/&gt; stanzas than may otherwise happen in a non-real-time text conversation. This may lead to increased network and server loading of XMPP networks.</p>
<p>Transmission of real-time text can be throttled temporarily during poor network conditions. It is appropriate to use latency monitoring mechanisms (e.g. &xep0184; or &xep0198;) in order to temporarily adjust the <link url="#transmission_interval">Transmission Interval</link> of real-time text beyond the recommended range. This results in lagged text (less real-time) but is better than failure during poor network conditions. The use of <link url="#message_reset">Message Reset</link> can also retransmit real-time text lost by poor network conditions, including stanzas dropped by an overloaded server. This is also useful for mission-critical applications such as Next Generation 9-1-1 emergency services.</p>
<p>The nature of real-time text can result in more frequent transmission of &lt;message/&gt; stanzas than would otherwise happen in a non-real-time text conversation. This can lead to increased network and server loading of XMPP networks.</p>
<p>Transmission of real-time text can be throttled temporarily during poor network conditions. It is appropriate to use latency monitoring mechanisms (e.g. &xep0184; or &xep0198;) in order to temporarily adjust the <link url="#transmission_interval">Transmission Interval</link> of real-time text beyond the recommended range. This results in lagged text (less real-time) but is better than failure during poor network conditions. The use of <link url="#message_reset">Message Reset</link> can also retransmit real-time text lost by poor network conditions, including stanzas dropped during a network issue or server error. These techniques are useful for mission-critical applications such as Next Generation 9-1-1 emergency services.</p>
<p>Excess numbers of real-time messages (e.g. during DoS scenario in <link url="#multiuser_chat">Multi-User Chat</link>) might cause local resource-consumption issues, which can be mitigated by accelerated time-out of <link url="#stale_messages">Stale Messages</link>.</p>
<p>Use of this specification in the recommended way will cause a load that is only marginally higher than a user communicating without this specification. Bandwidth overhead of real-time text is very low compared to many other activities possible on XMPP networks including in-band file transfers and audio. Bandwidth can also be further mitigated using stream compression, to benefit bandwidth-constrained networks (e.g. GPRS, 3G, satellite).</p>
<p>According to multiple university studies worldwide, the average length of instant messages is under 40 characters. The additional incremental bandwidth overhead of real-time text can be very low for an existing XMPP client, especially one already using many extensions. Bandwidth can also be further mitigated using stream compression, to benefit bandwidth-constrained networks (e.g. GPRS, 3G, satellite).</p>
</section2>
</section1>
<section1 topic="IANA Considerations" anchor="iana_considerations">
@ -1025,7 +1013,6 @@
<xs:sequence>
<xs:element ref='t' minOccurs='0' maxOccurs='unbounded'/>
<xs:element ref='e' minOccurs='0' maxOccurs='unbounded'/>
<xs:element ref='d' minOccurs='0' maxOccurs='unbounded'/>
<xs:element ref='w' minOccurs='0' maxOccurs='unbounded'/>
</xs:sequence>
</xs:complexType>
@ -1044,13 +1031,6 @@
</xs:complexType>
</xs:element>
<xs:element name='d' type='empty'>
<xs:complexType>
<xs:attribute name='p' type='xs:nonNegativeInteger' use='required'/>
<xs:attribute name='n' type='xs:nonNegativeInteger' use='optional' default='1'/>
</xs:complexType>
</xs:element>
<xs:element name='w' type='empty'>
<xs:complexType>
<xs:attribute name='n' type='xs:nonNegativeInteger' use='required'/>
@ -1066,8 +1046,8 @@
</xs:schema>]]></code></p>
</section1>
<section1 topic="Acknowledgments" anchor="acknowledgments">
<p>The author would like to thank Real-Time Text Taskforce (R3TF) at <link class="western" href="http://www.realtimetext.org/">www.realtimetext.org</link> for their contribution to the technology documented in this specification. Mark Rejhon leads the Jabber/XMPP Taskgroup at R3TF. Members of R3TF who have contributed to this document include Gunnar Hellstrom (Omnitor), Paul E. Jones (Cisco), Gregg Vanderheiden (Trace R&amp;D Center, University of Wisconsin), Barry Dingle (Interopability Leader, R3TF), and Arnoud van Wijk (Founder, R3TF). Others contributors include Bernard Aboba (Microsoft), Darren Sturman (Teligent Telecom), Christian Vogler (Gallaudet University), Norm Williams (Gallaudet University), and several members from the XMPP Standards Mailing List, including Kevin Smith (XSF), Peter Saint Andre (XSF), and many others.</p>
<p>“Natural Typing”, the technique of <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>, is acknowledged as an invention by Mark Rejhon, who is deaf. This technology is provided to XMPP.org as part of this specification in compliance of the XSF's Intellectual Property Rights Policy at <link class="western" href="http://xmpp.org/extensions/ipr-policy.shtml">http://xmpp.org/extensions/ipr-policy.shtml</link>.</p>
<p>The members of the Real-Time Text Taskforce (R3TF), <link class="western" href="http://www.realtimetext.org/">www.realtimetext.org</link>, has contributed greatly specification. Mark Rejhon leads the Jabber/XMPP Taskgroup at R3TF. Members of R3TF who have contributed to this specification include Gunnar Hellstrom, Paul E. Jones, Gregg Vanderheiden, Barry Dingle, and Arnoud van Wijk. Others contributors include Bernard Aboba, Mark Grady, Darren Sturman, Christian Vogler, Norm Williams, and several members from the XMPP Standards Mailing List, including Kevin Smith, Peter Saint Andre and many others.</p>
<p>The technique of <link url="#preserving_key_press_intervals">Preserving Key Press Intervals</link>, otherwise called "natural typing", was created by Mark Rejhon, who is deaf. It is incorporated into this specification in compliance of the XSF's Intellectual Property Rights Policy at <link class="western" href="http://xmpp.org/extensions/ipr-policy.shtml">http://xmpp.org/extensions/ipr-policy.shtml</link>.</p>
</section1>