Skip to content
Permalink
Browse files

[] (0) Update WebSocket to use ports 80 and 443 instead of 81 and 815…

…, on advice from IANA.

git-svn-id: http://svn.whatwg.org/webapps@3725 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Sep 2, 2009
1 parent 4b84b3a commit b21d940564309dd1b29346c421c3357c4d0bdec8
Showing with 19 additions and 38 deletions.
  1. +1 −1 index
  2. +18 −37 source
2 index
@@ -71,7 +71,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML5</h1>
<h2 class="no-num no-toc" id=draft-standard-&mdash;-1-september-2009>Draft Standard &mdash; 1 September 2009</h2>
<h2 class="no-num no-toc" id=draft-standard-&mdash;-2-september-2009>Draft Standard &mdash; 2 September 2009</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
55 source
only relationship to HTTP is that its handshake is interpreted by
HTTP servers as an Upgrade request.</p>

<p>The Web Socket protocol by default uses port 81 for regular
Web Socket connections and port 815 for Web Socket connections
tunneled over TLS.</p>
<p>Based on the expert recommendation of the IANA<!-- [IANA #257455]
-->, the Web Socket protocol by default uses port 80 for regular Web
Socket connections and port 443 for Web Socket connections tunneled
over TLS.</p>


<h6>Establishing a connection</h6>

<p>There are several options for establishing a Web Socket connection.</p>

<p>The simplest method is to use port 81 to get a direct connection
to a Web Socket server. However, this port may be blocked by
firewalls.</p>

<p>The second simplest method is to use TLS encryption and port 815
to connect directly to a Web Socket server. This is the preferred
solution, as it is secure and correct. However, TLS encryption can
be computationally expensive, and port 815 might also be blocked by
firewalls.</p>

<p>To avoid firewalls, ports 80 and 443 might be used instead. These
are the HTTP and HTTPS ports. Port 80 traffic, however, will often
be intercepted by HTTP proxies, which can lead to the connection
<p>The simplest method is to use port 80 to get a direct connection
to a Web Socket server. Port 80 traffic, however, will often be
intercepted by HTTP proxies, which can lead to the connection
failing to be established.</p>

<p>Port 443, using encryption, is therefore the most reliable
solution. It is unlikely to be blocked by a firewall or intercepted
by a proxy. However, again, TLS encryption can be computationally
<p>The second simplest method is to use TLS encryption and port 443
to connect directly to a Web Socket server. This has the advantage
of being more secure; however, TLS encryption can be computationally
expensive.</p>

<p>When a connection is to be made to a port that is shared by an
<pre>GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: example.com:81
Host: example.com
Origin: http://example.com
WebSocket-Protocol: sample</pre>


<li><p>If there is no explicit <var title="">port</var>, then: if
<var title="">secure</var> is false, let <var title="">port</var>
be 81, otherwise let <var title="">port</var> be 815.</p></li>
be 80, otherwise let <var title="">port</var> be 443.</p></li>

<li><p>Let <var title="">resource name</var> be the value of the
<span title="url-path">&lt;path&gt;</span> component (which might
title="">url</var>.</li>

<li>If the <var title="">secure</var> flag is false and port is
not 81, or if the <var title="">secure</var> flag is true and
port is not 815, then append the string "<code title="">:</code>"
not 80, or if the <var title="">secure</var> flag is true and
port is not 443, then append the string "<code title="">:</code>"
followed by <var title="">port</var> to <var
title="">url</var>.</li>

<p>For example, if the server had a username and password that
applied to <code title="">http://example.com/socket</code>, and
the Web Socket was being opened to <code
title="">ws://example.com:80/socket</code>, it could send
title="">ws://example.com/socket</code>, it could send
them:</p>

<pre>Authorization: Basic d2FsbGU6ZXZl</pre>

<p>However, it would not send them if the Web Socket was being
opened to <code title="">ws://example.com/socket</code>, as that
uses a different port (81, not 80).</p>

</div>

</li>

<p>For instance:</p>

<pre>WebSocket-Location: ws://example.com:80/demo</pre>
<pre>WebSocket-Location: ws://example.com/demo</pre>

</div>

<p class="note">Do not include the port if it is the default port
for Web Socket protocol connections of the type in question (81 for
unencrypted connections and 815 for encrypted connections).</p>
for Web Socket protocol connections of the type in question (80 for
unencrypted connections and 443 for encrypted connections).</p>

<p>Send another CRLF pair (0x0d 0x0a).</p>

</dl>


<h6>Registration of ports 81 and 815</h6>

<p>See IANA ticket #257454 for port 81 and IANA ticket #257455 for
port 815.</p>


<h6>Registration of the "WebSocket" HTTP Upgrade keyword</h6>

<dl>

0 comments on commit b21d940

Please sign in to comment.
You can’t perform that action at this time.