title: Firefox can't establish a websocket connection while Chrome can
body: <p>I'm developing a webapp and I'm including websocket connectivity. I've installed a websocket server with node.js (5.0.0) with websocket (<a href="https://www.npmjs.com/package/websocket" rel="noreferrer">https://www.npmjs.com/package/websocket</a>).</p>
  
  <p>In Chrome it works perfectly but in Firefox this message appears in console:</p>
  
  <pre><code>Firefox no puede establecer una conexión con el servidor en wss://www.my-dev-server.com:1337/.
  </code></pre>
  
  <p>(Firefox can't establish a connection with server at...)</p>
  
  <p>This is the server code (basically as in examples):</p>
  
  <pre><code>var WebSocketServer = require('websocket').server;
  
  var https = require('https');
  var fs = require('fs');
  
  var options = {
    key: fs.readFileSync('/keyfile.key'),
    cert: fs.readFileSync('/pemfile.pem')
  };
  var port = 1337; 
  
  // Create HTTPS service.
  var server = https.createServer(options, function(request, response) {
      console.log((new Date()) + ' Received request for ' + request.url);
      response.writeHead(404);
      response.end();
  });     
  
  server.listen(port, function() {
      console.log((new Date()) + ' Server is listening on port ' + port);
  });
  
  // create the server
  wsServer = new WebSocketServer({
      httpServer: server,
      autoAcceptConnections: false
  });
  
  function originIsAllowed( origin ) {
      // TODO: complete
      return true;
  }
  
  var clients = [];
  
  // WebSocket server
  wsServer.on('request', function(request) {
  
      if( !originIsAllowed( request.origin ) ) {
          request.reject();
          console.log((new Date()) + ' Connection from origin ' + request.origin + 'rejected.');
          return;
      }
      console.log((new Date()) + ' Connection accepted from ' + request.origin + '.');
  
      var connection = request.accept(null, request.origin);
      clients.push(connection);
  
      connection.on('message', function( message ) {
          if (message.type === 'utf8') {
              console.log('Received Message: ' + message.utf8Data);
          }
          else if( message.type === 'binary' ) {
  
          }
      });
  
      connection.on( 'error', function( error ) {
      });
  
      connection.on('close', function( reasonCode, description ) {
          console.log((new Date()) + " Peer " + connection.remoteAddress + " disconnected.");
      });
  });
  </code></pre>
  
  <p>I use a self-signed certificate for development purposes, the same that is used by the web server.</p>
  
  <p>This is my client code:</p>
  
  <pre><code>var connection = new WebSocket('wss://www.my-dev-server.com:1337');
  
  connection.onopen = function () { };
  
  connection.onerror = function (error) { };
  
  connection.onmessage = function (message) {
      /* some code here */
  };
  </code></pre>