title: SignalR js client seems to be ignoring the url port
body: <p>I'm trying to put together a simple "Hello World" style application with SignalR. The slightly complicating factor is that the SignalR hubs need to be self-hosted, not in IIS/ASP.NET. I've got the server-side working, so far as I can tell, and it's available on port 8080, but I'm having trouble wiring up the client. The problem  I'm bumping up against at the moment is that the SignalR client seems to be ignoring the port on the URL that I specify. </p>
  
  <p>Specifically, I've got this code here:</p>
  
  <pre><code>&lt;head runat="server"&gt;
      &lt;script type="text/javascript" src="/Scripts/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/Scripts/json2.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="/Scripts/jquery.signalR-0.5.3.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="http://&lt;%=Request.Url.Host %&gt;:8080/signalr/hubs"&gt;&lt;/script&gt;
      &lt;title&gt;SignalR Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script type="text/javascript"&gt;
          $(function () {
  
              // Wire up the client to the SignalR server on the same host 
              // as the source of this page, but on port 8080.
              $.connection.url = "http://&lt;%=Request.Url.Host %&gt;:8080/signalr";
              var roomHub = $.connection.roomHub;
  
              $('#echoButton').click(function () {
                  roomHub.echo($('#echoButton').val())
                      .error(function (err) {
                          alert(err);
                      });
              });
  
              $.connection.hub.start({ transport: 'auto', xdomain: true })
                  .done(function () {
                      console.log('Connected.');
                  })
                  .fail(function (e) {
                      console.log('Unable to connect:' + e);
                  });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>The :8080/signalr/hubs script loads successfully, and it looks good, i.e., it has the definition for the <code>roomHub</code> in it, so I know that the server is up and running.</p>
  
  <p>However, when <code>$.connection.hub.start()</code> runs, it seems like it <em>should</em> try to open up a connection for a URL something like <a href="http://app.dev.alanta.com:8080/signalr/signalr/negotiate?_=1353072553935" rel="noreferrer">http://app.dev.alanta.com:8080/signalr/signalr/negotiate?=1353072553935</a>. Instead, Firebug tells me that it's ignoring the 8080 portion, and is instead trying to negotiate a connection with the URL <a href="http://app.dev.alanta.com/signalr/signalr/negotiate?_=1353072553935" rel="noreferrer">http://app.dev.alanta.com/signalr/signalr/negotiate?=1353072553935</a>. And of course, that doesn't work - there's no SignalR service listening on port 80, just the regular web server - so it fails with the message, "Unable to connect:SignalR: Error during negotiation request".</p>
  
  <p>I should also note that in the jquery.signalR-0.5.3.js file, the bit of code that parses out the connection does indeed seem to ignore the port:</p>
  
  <pre><code>// Resolve the full url
  parser.href = connection.url;
  if (!parser.protocol || parser.protocol === ":") {
      connection.protocol = window.document.location.protocol;
      connection.host = window.document.location.host;
      connection.baseUrl = connection.protocol + "//" + connection.host;
  }
  else {
      connection.protocol = parser.protocol;
      connection.host = parser.host;
      connection.baseUrl = parser.protocol + "//" + parser.host;
  }
  
  // Set the websocket protocol
  connection.wsProtocol = connection.protocol === "https:" ? "wss://" : "ws://";
  </code></pre>
  
  <p>Is this a bug? Or have I misunderstood something?</p>