WebSocket SyntaxError: An invalid or illegal string was specified
<p>I'm getting a <code>SyntaxError: An invalid or illegal string was specified</code>, while trying to connect to a WebSocket on Firefox.</p>

<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
  &lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;script&gt;
    var socket = new WebSocket('127.0.0.1:1234');
    &lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Why do I get this error?</p>