title: WebSocket server does not work with SSL
body: <p>I have a working chat application using websockets. I want to go one step further and enable encryption on my connections, however when I switch up the http server with a https one my connections start failing.</p>
  
  <p>I have generated a self-signed certificate that I use on all of my websites (under the same TLD, which implies it is a wildcard certificate). I can confirm it is a valid certificate, so the problem should not be there.</p>
  
  <p>This is what works (unencrypted)</p>
  
  <pre><code>var webSocketServer = require('websocket').server;
  var http = require('http');
  
  var server = http.createServer(function() {});
  server.listen(webSocketsServerPort, function () {
      log("system", "Server is listening on port " + webSocketsServerPort);
  });
  
  var wsServer = new webSocketServer({
      httpServer: server
  });
  </code></pre>
  
  <p>Using this I can now connect to <code>ws://my.domain:port</code>. </p>
  
  <p>This is what does <strong>not</strong> work</p>
  
  <pre><code>var webSocketServer = require('websocket').server;
  var http = require('https');
  var fs = require('fs');
  
  var server = http.createServer({
      key: fs.readFileSync("path/to/host.key"),
      cert: fs.readFileSync("path/to/host.pem")
  });
  server.listen(webSocketsServerPort, function () {
      log("system", "Server is listening on port " + webSocketsServerPort);
  });
  
  var wsServer = new webSocketServer({
      httpServer: server
  });
  </code></pre>
  
  <p>With this code the server starts as well, I see the log message "Server is listening.." but when I try to connect at <code>wss://my.domain:port</code> the connection can not be established.</p>
  
  <p>I have added an exception in my browser for the certificate because my client page and websocket server address are under the same tld and sub-domain.</p>
  
  <p>What could be the problem?</p>