title="handler-WebSocket-onclose">onclose</span>;
readonly attribute DOMString <span
title="dom-WebSocket-protocol">protocol</span>;
void <span title="dom-WebSocket-close">close</span>(in optional
unsigned short code, in optional DOMString reason);
@@ -89515,12 +89565,12 @@
<ol>
- <li><p><span>Parse a WebSocket URL's components</span> from the
- <var title="">url</var> argument, to obtain <var
- title="">host</var>, <var title="">port</var>, <var
- title="">resource name</var>, and <var title="">secure</var>. If
- this fails, throw a <code>SYNTAX_ERR</code> exception and abort
- these steps. <a href="#refsWSP">[WSP]</a></p></li>
+ <li><p><i>Parse a WebSocket URL's components</i> from the <var
+ title="">url</var> argument, to obtain <var title="">host</var>,
+ <var title="">port</var>, <var title="">resource name</var>, and
+ <var title="">secure</var>. If this fails, throw a
+ <code>SYNTAX_ERR</code> exception and abort these steps. <a
+ href="#refsWSP">[WSP]</a></p></li>
<li>
@@ -89567,20 +89617,18 @@
<li>
- <p><span>Establish a WebSocket connection</span> to a host <var
- title="">host</var>, on port <var title="">port</var> (if one was
- specified), from <var title="">origin</var>, with the flag <var
- title="">secure</var>, with <var title="">resource name</var> as
- the resource name, with <var title="">protocols</var> as the
- (possibly empty) list of protocols, and with the <var
- title="">defer cookies</var> flag set. <a
+ <p><i>Establish a WebSocket connection</i> given the set (<var
+ title="">host</var>, <var title="">port</var>, <var
+ title="">resource name</var>, <var title="">secure</var>), along
+ with the <var title="">protocols</var> list and an empty list for
+ the extensions, and <var title="">origin</var>. <a
href="#refsWSP">[WSP]</a></p>
- <p>When the user agent <i>validates the server's response</i> during
- the "<span>establish a WebSocket connection</span>" algorithm, if
- the status code received from the server is not 101 (e.g. it is a
- redirect), the user agent must <span>fail the websocket
- connection</span>.</p>
+ <p>When the user agent <i title="validate the server's
+ response">validates the server's response</i> during the
+ "<i>establish a WebSocket connection</i>" algorithm, if the status
+ code received from the server is not 101 (e.g. it is a redirect),
+ the user agent must <i>fail the websocket connection</i>.</p>
<p class="warning">Following HTTP procedures here could introduce
serious security problems in a Web browser context. For example,
@@ -89591,12 +89639,11 @@
even if the script checks that the URL has the right hostname.</p>
<!--
http://www.ietf.org/mail-archive/web/hybi/current/msg06951.html -->
- <p class="note">If the "<span>establish a WebSocket
- connection</span>" algorithm fails, it triggers the "<span>fail
- the WebSocket connection</span>" algorithm, which then invokes
- the "<span>close the WebSocket connection</span>" algorithm,
- which then establishes that the "<span>WebSocket connection is
- closed</span>", which fires the <code
+ <p class="note">If the <i>establish a WebSocket connection</i>
+ algorithm fails, it triggers the <i>fail the WebSocket
+ connection</i> algorithm, which then invokes the <i>close the
+ WebSocket connection</i> algorithm, which then establishes that
+ <i>the WebSocket connection is closed</i>, which fires the <code
title="event-close">close</code> event <a
href="#closeWebSocket">as described below</a>.</p>
@@ -89629,7 +89676,7 @@
<dt><dfn title="dom-WebSocket-OPEN"><code>OPEN</code></dfn> (numeric
value 1)</dt>
- <dd>The <span>WebSocket connection is established</span> and
communication is possible.</dd>
+ <dd><i>The WebSocket connection is established</i> and communication
is possible.</dd>
<dt><dfn title="dom-WebSocket-CLOSING"><code>CLOSING</code></dfn>
(numeric value 2)</dt>
@@ -89647,8 +89694,8 @@
<p>The <dfn
title="dom-WebSocket-protocol"><code>protocol</code></dfn> attribute
- must initially return the empty string. After the <span>WebSocket
- connection is established</span>, its value might change, as defined
+ must initially return the empty string. After <i>the WebSocket
+ connection is established</i>, its value might change, as defined
below.</p>
<p class="note">The <code
@@ -89688,34 +89735,34 @@
</dd>
- <dt>If the WebSocket connection is not yet <span title="WebSocket
- connection is established">established</span> <a
+ <dt>If the WebSocket connection is not yet <i title="the
+ WebSocket connection is established">established</i> <a
href="#refsWSP">[WSP]</a></dt>
<dd>
- <p><span>Fail the WebSocket connection</span> and set the <code
+ <p><i>Fail the WebSocket connection</i> and set the <code
title="dom-WebSocket-readyState">readyState</code> attribute's
value to <code title="dom-WebSocket-CLOSING">CLOSING</code> (2).
<a href="#refsWSP">[WSP]</a></p>
- <p class="note">The "<span>fail the WebSocket connection</span>"
- algorithm invokes the "<span>close the WebSocket
- connection</span>" algorithm, which then establishes that the
- "<span>WebSocket connection is closed</span>", which fires the
+ <p class="note">The <i>fail the WebSocket connection</i>
+ algorithm invokes the <i>close the WebSocket
+ connection</i> algorithm, which then establishes that
+ <i>the WebSocket connection is closed</i>, which fires the
<code title="event-close">close</code> event <a
href="#closeWebSocket">as described below</a>.</p>
</dd>
- <dt>If the WebSocket closing handshake has not yet been <span
- title="the WebSocket closing handshake has
- started">started</span> <a href="#refsWSP">[WSP]</a></dt>
+ <dt>If the WebSocket closing handshake has not yet been <i
+ title="the WebSocket closing handshake is
+ started">started</i> <a href="#refsWSP">[WSP]</a></dt>
<dd>
- <p><span>Start the WebSocket closing handshake</span> and set the
+ <p><i>Start the WebSocket closing handshake</i> and set the
<code title="dom-WebSocket-readyState">readyState</code>
attribute's value to <code
title="dom-WebSocket-CLOSING">CLOSING</code> (2). <a
@@ -89728,13 +89775,14 @@
<p>If the second argument is also present, then it must be
encoded as UTF-8 and provided in the Close message after the
- status code<!--CLOSE CODE-->. <a href="#refsWSP">[WSP]</a></p>
+ status code<!--CLOSE CODE-->. <a
+ href="#refsRFC3629">[RFC3629]</a> <a href="#refsWSP">[WSP]</a></p>
- <p class="note">The "<span>start the WebSocket closing
- handshake</span>" algorithm eventually invokes the "<span>close
- the WebSocket connection</span>" algorithm, which then establishes
- that the "<span>WebSocket connection is closed</span>", which
- fires the <code title="event-close">close</code> event <a
+ <p class="note">The <i>start the WebSocket closing handshake</i>
+ algorithm eventually invokes the <i>close the WebSocket
+ connection</i> algorithm, which then establishes that <i>the
+ WebSocket connection is closed</i>, which fires the <code
+ title="event-close">close</code> event <a
href="#closeWebSocket">as described below</a>.</p>
</dd>
@@ -89749,11 +89797,11 @@
value to <code title="dom-WebSocket-CLOSING">CLOSING</code>
(2).</p>
- <p class="note"><span>The WebSocket closing handshake has
- started</span>, and will eventually invokethe "<span>close the
- WebSocket connection</span>" algorithm, which will establish that
- the "<span>WebSocket connection is closed</span>", and thus the
- <code title="event-close">close</code> event will fire, <a
+ <p class="note"><i>The WebSocket closing handshake is
+ started</i>, and will eventually invoke the <i>close the
+ WebSocket connection</i> algorithm, which will establish that
+ <i>the WebSocket connection is closed</i>, and thus the <code
+ title="event-close">close</code> event will fire, <a
href="#closeWebSocket">as described below</a>.</p>
</dd>
@@ -89768,19 +89816,19 @@
<p>The <dfn
title="dom-WebSocket-bufferedAmount"><code>bufferedAmount</code></dfn>
- attribute must return the number of bytes of UTF-8 text that have
- been queued using <code title="dom-WebSocket-send">send()</code> but
- that, as of the last time the <span>event loop</span> started
- executing a <span title="concept-task">task</span>, had not yet been
- transmitted to the network. (This thus includes any text sent during
- the execution of the current task, regardless of whether the user
- agent is able to transmit text asynchronously with script
- execution.) This does not include framing overhead incurred by the
- protocol, or buffering done by the operating system or network
- hardware. If the connection is closed, this attribute's value will
- only increase with each call to the <code
- title="dom-WebSocket-send">send()</code> method (the number does not
- reset to zero once the connection closes).</p>
+ attribute must return the number of bytes of application data (UTF-8
+ text and binary data) that have been queued using <code
+ title="dom-WebSocket-send">send()</code> but that, as of the last
+ time the <span>event loop</span> started executing a <span
+ title="concept-task">task</span>, had not yet been transmitted to
+ the network. (This thus includes any text sent during the execution
+ of the current task, regardless of whether the user agent is able to
+ transmit text asynchronously with script execution.) This does not
+ include framing overhead incurred by the protocol, or buffering done
+ by the operating system or network hardware. If the connection is
+ closed, this attribute's value will only increase with each call to
+ the <code title="dom-WebSocket-send">send()</code> method (the
+ number does not reset to zero once the connection closes).</p>
<div class="example">
@@ -89857,19 +89905,20 @@
<p>If the <var title="">data</var> argument has any unpaired
surrogates, then raise an <code>SYNTAX_ERR</code> exception. If
- the connection is established, and the string has no unpaired
- surrogates, and <span title="the WebSocket closing handshake has
- started">the WebSocket closing handshake has not yet
- started</span>, then the user agent must <span>send <var
- title="">data</var> using the WebSocket</span> using a text frame
- opcode; if the data cannot be sent, e.g. because it would need to
- be buffered but the buffer is full, the user agent must
- <span>close the WebSocket connection</span>. Any invokation of
- this method with a string argument that does not raise an
- exception must increase the <code
+ <i>the WebSocket connection is established</i>, and the
+ string has no unpaired surrogates, and <i title="the WebSocket
+ closing handshake is started">the WebSocket closing handshake has
+ not yet started</i>, then the user agent must <i>send a WebSocket
+ Message</i> comprised of <var title="">data</var> using a text
+ frame opcode; if the data cannot be sent, e.g. because it would
+ need to be buffered but the buffer is full, the user agent must
+ <i>close the WebSocket connection</i>. Any invokation of this
+ method with a string argument that does not raise an exception
+ must increase the <code
title="dom-WebSocket-bufferedAmount">bufferedAmount</code>
attribute by the number of bytes needed to express the argument as
- UTF-8. <a href="#refsWSP">[WSP]</a></p>
+ UTF-8. <a href="#refsRFC3629">[RFC3629]</a> <a
+ href="#refsWSP">[WSP]</a></p>
</dd>
@@ -89878,18 +89927,18 @@
<dd>
- <p>If the connection is established, and <span title="The
- WebSocket Closing Handshake is Started">the WebSocket closing
- handshake has not yet started</span>, then the user agent must
- <span>send <var title="">data</var> using the WebSocket</span>
- using a binary frame opcode; if the data cannot be sent, e.g.
- because it would need to be buffered but the buffer is full, the
- user agent must <span>close the WebSocket connection</span>. The
- data to be sent is the raw data represented by the
- <code>Blob</code> object. <!-- that sentence is meant to invoke
- "This interface represents immutable raw data." --> Any invokation
- of this method with a <code>Blob</code> argument that does not
- raise an exception must increase the <code
+ <p>If <i>the WebSocket connection is established</i>, and <i
+ title="the WebSocket closing handshake is started">the WebSocket
+ closing handshake has not yet started</i>, then the user agent
+ must <i>send a WebSocket Message</i> comprised of <var
+ title="">data</var> using a binary frame opcode; if the data
+ cannot be sent, e.g. because it would need to be buffered but the
+ buffer is full, the user agent must <i>close the WebSocket
+ connection</i>. The data to be sent is the raw data represented by
+ the <code>Blob</code> object. <!-- that sentence is meant to
+ invoke "This interface represents immutable raw data." --> Any
+ invokation of this method with a <code>Blob</code> argument that
+ does not raise an exception must increase the <code
title="dom-WebSocket-bufferedAmount">bufferedAmount</code>
attribute by the size of the <code>Blob</code> object's raw data,
in bytes. <!-- that sentence is meant to invoke the same as
@@ -89903,19 +89952,20 @@
<dd>
- <p>If the connection is established, and <span title="The
- WebSocket Closing Handshake is Started">the WebSocket closing
- handshake has not yet started</span>, then the user agent must
- <span>send <var title="">data</var> using the WebSocket</span>
- using a binary frame opcode; if the data cannot be sent, e.g.
- because it would need to be buffered but the buffer is full, the
- user agent must <span>close the WebSocket connection</span>. The
- data to be sent is the data stored in the buffer described by the
- <code>ArrayBuffer</code> object. <!-- that sentence is meant to
- invoke "The ArrayBuffer type describes a buffer used to store data
- for the array buffer views." at the top of the Typed Array spec
- --> Any invokation of this method with an <code>ArrayBuffer</code>
- argument that does not raise an exception must increase the <code
+ <p>If <i>the WebSocket connection is established</i>, and <i
+ title="the WebSocket closing handshake is started">the WebSocket
+ closing handshake has not yet started</i>, then the user agent
+ must <i>send a WebSocket Message</i> comprised of <var
+ title="">data</var> using a binary frame opcode; if the data
+ cannot be sent, e.g. because it would need to be buffered but the
+ buffer is full, the user agent must <i>close the WebSocket
+ connection</i>. The data to be sent is the data stored in the
+ buffer described by the <code>ArrayBuffer</code> object. <!-- that
+ sentence is meant to invoke "The ArrayBuffer type describes a
+ buffer used to store data for the array buffer views." at the top
+ of the Typed Array spec --> Any invokation of this method with an
+ <code>ArrayBuffer</code> argument that does not raise an exception
+ must increase the <code
title="dom-WebSocket-bufferedAmount">bufferedAmount</code>
attribute by the length of the <code>ArrayBuffer</code> in bytes.
<!-- that sentence is meant to invoke the same as
@@ -89938,7 +89988,7 @@
<tbody>
<tr><td><dfn
title="handler-WebSocket-onopen"><code>onopen</code></dfn> <td> <code
title="event-open">open</code>
<tr><td><dfn
title="handler-WebSocket-onmessage"><code>onmessage</code></dfn> <td>
<code title="event-message">message</code>
- <tr><td><dfn
title="handler-WebSocket-onerror"><code>onerror</code></dfn> <td> <code
title="event-error">error</code>
+<!-- <tr><td><dfn
title="handler-WebSocket-onerror"><code>onerror</code></dfn> <td> <code
title="event-error">error</code>-->
<tr><td><dfn
title="handler-WebSocket-onclose"><code>onclose</code></dfn> <td> <code
title="event-close">close</code>
</table>
@@ -89946,32 +89996,36 @@
<h4>Feedback from the protocol</h4>
- <p>When the <i>WebSocket connection is established</i>, the user
- agent must <span>queue a task</span> to first change the <code
- title="dom-WebSocket-readyState">readyState</code> attribute's value
- to <code title="dom-WebSocket-OPEN">OPEN</code> (1); <span>apply the
- cookies</span>
-<!--
-Once we have the cookies back:
+ <p>When <i>the WebSocket connection is established</i>, the user
+ agent must <span>queue a task</span> to run these steps:</p>
- <li><p>Act as if <span title="receives a
- set-cookie-string">receiving a set-cookie-string</span> for
- <span>the document's address</span>,
- consisting of the value of the element's <code
- title="attr-meta-content">content</code> attribute encoded as
- UTF-8. <a href="#refsCOOKIES">[COOKIES]</a> <a
- href="#refsRFC3629">[RFC3629]</a></p></li>
+ <ol>
--->
- that were collected in the <var title="">list of
- cookies</var> when the <span title="WebSocket connection is
- established">connection was established</span>; change the <code
- title="dom-WebSocket-protocol">protocol</code> attribute's value to
- the <span>selected WebSocket subprotocol</span>, if there is one;
- and then <span>fire a simple event</span> named <code
- title="event-open">open</code> at the <code>WebSocket</code> object.
- <a href="#refsWSP">[WSP]</a></p>
+ <li><p>Change the <code
+ title="dom-WebSocket-readyState">readyState</code> attribute's
+ value to <code title="dom-WebSocket-OPEN">OPEN</code> (1).</p></li>
+ <li><p>Change the <code
+ title="dom-WebSocket-protocol">protocol</code> attribute's value to
+ the <i>subprotocol in use</i>, if is not the null value. <a
+ href="#refsWSP">[WSP]</a></p></li>
+
+ <li><p>Act as if the user agent had <span title="receives a
+ set-cookie-string">received a set-cookie-string</span> for
+ <span>the document's address</span>, consisting of the <i>cookies
+ set during the server's opening handshake</i>. <a
+ href="#refsCOOKIES">[COOKIES]</a> <a
+ href="#refsRFC3629">[RFC3629]</a> <a
+ href="#refsWSP">[WSP]</a></p></li>
+
+ <li><p><span>Fire a simple event</span> named <code
+ title="event-open">open</code> at the <code>WebSocket</code>
+ object.</p>
+
+ </ol>
+
+ <hr>
+
<p>When <i>a WebSocket message has been received</i> with type <var
title="">type</var> and data <var title="">data</var>, the user
agent must <span>queue a task</span> to follow these steps: <a
@@ -90047,6 +90101,8 @@
title="concept-task">task</span> so as to avoid stalling the main
thread while it created the <code>ArrayBuffer</code> object.</p>
+ <hr>
+<!--
<p>When <i>a WebSocket error has been detected</i>, the user agent
must <span>queue a task</span> to check to see if the <code
title="dom-WebSocket-readyState">readyState</code> attribute's value
@@ -90055,8 +90111,8 @@
<span>fire a simple event</span> named <code
title="event-error">error</code> at the <code>WebSocket</code>
object. <a href="#refsWSP">[WSP]</a></p>
-
- <p>When <i>the WebSocket closing handshake has started</i>, the user
+-->
+ <p>When <i>the WebSocket closing handshake is started</i>, the user
agent must <span>queue a task</span> to change the <code
title="dom-WebSocket-readyState">readyState</code> attribute's value
to <code title="dom-WebSocket-CLOSING">CLOSING</code> (2). (If the
@@ -90066,7 +90122,7 @@
title="dom-WebSocket-CLOSING">CLOSING</code> (2) when this task
runs.) <a href="#refsWSP">[WSP]</a></p>
- <p id="closeWebSocket">When the <i>WebSocket connection is
+ <p id="closeWebSocket">When <i>the WebSocket connection is
closed</i>, possibly <i title="">cleanly</i>, the user agent must
create an event that uses the <code>CloseEvent</code> interface,
with the event name <code title="event-close">close</code>, which
@@ -90074,9 +90130,9 @@
<code title="dom-CloseEvent-wasClean">wasClean</code> attribute is
set to true if the connection closed <i title="">cleanly</i> and
false otherwise, whose <code title="dom-CloseEvent-code">code</code>
- attribute is set to the <i>WebSocket connection close code</i>, and
+ attribute is set to <i>the WebSocket connection close code</i>, and
whose <code title="dom-CloseEvent-reason">reason</code> attribute is
- set to the <i>WebSocket connection close reason</i>; and <span>queue
+ set to <i>the WebSocket connection close reason</i>; and <span>queue
a task</span> to first change the <code
title="dom-WebSocket-readyState">readyState</code> attribute's value
to <code title="dom-WebSocket-CLOSED">CLOSED</code> (3), and then
@@ -90129,8 +90185,8 @@
executing a <span title="concept-task">task</span> must not be
garbage collected if there are any event listeners registered for
<code title="event-open">open</code> events, <code
- title="event-message">message</code> events, <code
- title="event-error">error</code> events, or <code
+ title="event-message">message</code> events<!--, <code
+ title="event-error">error</code> events-->, or <code
title="event-close">close</code> events.</p>
<p>A <code>WebSocket</code> object whose <code
@@ -90140,18 +90196,18 @@
the <span>event loop</span> started executing a <span
title="concept-task">task</span> must not be garbage collected if
there are any event listeners registered for <code
- title="event-message">message</code> events, <code
- title="event-error">error</code> events, or <code
+ title="event-message">message</code> events<!--, <code
+ title="event-error">error</code> events-->, or <code
title="event-close">close</code> events.</p>
- <p>A <code>WebSocket</code> object with <span title="WebSocket
- connection is established">an established connection</span> that has
+ <p>A <code>WebSocket</code> object with <i title="the WebSocket
+ connection is established">an established connection</i> that has
data queued to be transmitted to the network must not be garbage
collected. <a href="#refsWSP">[WSP]</a></p>
<p>If a <code>WebSocket</code> object is garbage collected while its
- connection is still open, the user agent must <span>start the
- WebSocket closing handshake</span>, with no status code<!--CLOSE
+ connection is still open, the user agent must <i>start the
+ WebSocket closing handshake</i>, with no status code<!--CLOSE
CODE--> for the Close message. <a href="#refsWSP">[WSP]</a></p>
<hr>
@@ -90163,25 +90219,25 @@
<dl class="switch">
- <dt>If the WebSocket connection is not yet <span title="WebSocket
- connection is established">established</span> <a
+ <dt>If the WebSocket connection is not yet <i title="the WebSocket
+ connection is established">established</i> <a
href="#refsWSP">[WSP]</a></dt>
<dd>
- <p><span>Fail the WebSocket connection</span>. <a
+ <p><i>Fail the WebSocket connection</i>. <a
href="#refsWSP">[WSP]</a></p>
</dd>
- <dt>If the WebSocket closing handshake has not yet been <span
- title="the WebSocket closing handshake has started">started</span>
+ <dt>If the WebSocket closing handshake has not yet been <i
+ title="the WebSocket closing handshake is started">started</i>
<a href="#refsWSP">[WSP]</a></dt>
<dd>
- <p><span>Start the WebSocket closing handshake</span>, with the
+ <p><i>Start the WebSocket closing handshake</i>, with the
status code<!--CLOSE CODE--> to use in the WebSocket Close message
being 1001. <a href="#refsWSP">[WSP]</a></p>
_______________________________________________
Commit-Watchers mailing list
[email protected]
http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org