title: CORS node js issue
body: <p>Having gone through multiple posts on stack I still couldn't find a right answer.</p>
  
  <p>Checked the documentation on <a href="https://github.com/expressjs/cors#user-content-simple-usage-enable-all-cors-requests" rel="noreferrer">CORS</a> extension as well.</p>
  
  <p>I have the following server code up and running:</p>
  
  <pre><code>var WebSocketServer = require("ws").Server
  var http = require("http")
  var express = require('express')
  var cors = require('cors')
  var app = express();
  
  app.use(cors());
  var port = process.env.PORT || 9000
  
  var server = http.createServer(app)
  server.listen(port)
  var count   = 0;
  var clients = {};
  var rooms   = {};
  var wss = new WebSocketServer({server: server})
  wss.on("connection", function(ws) {
      ws.on("create-room", function(data) {
          rooms[data] = {creator : data.user_id, created : new Date()}
      })
      ws.on("close", function() {
          console.log("websocket connection close")
      })
  })
  </code></pre>
  
  <p>But I get:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load
    <a href="http://localhost:9000/socket.io/?EIO=3&amp;transport=polling&amp;t=LE-CbU0" rel="noreferrer">http://localhost:9000/socket.io/?EIO=3&amp;transport=polling&amp;t=LE-CbU0</a>. A
    wildcard '*' cannot be used in the 'Access-Control-Allow-Origin'
    header when the credentials flag is true. Origin
    '<a href="http://localhost:8100" rel="noreferrer">http://localhost:8100</a>' is therefore not allowed access. The
    credentials mode of an XMLHttpRequest is controlled by the
    withCredentials attribute.</p>
  </blockquote>
  
  <p>If I comment the line with <code>app.use(cors());</code> </p>
  
  <p>I get :</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load
    <a href="http://localhost:9000/socket.io/?EIO=3&amp;transport=polling&amp;t=LE-Cwb8" rel="noreferrer">http://localhost:9000/socket.io/?EIO=3&amp;transport=polling&amp;t=LE-Cwb8</a>. No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://localhost:8100" rel="noreferrer">http://localhost:8100</a>' is therefore not allowed
    access. The response had HTTP status code 404.</p>
  </blockquote>
  
  <p>So clearly my server is up and running ok but</p>