Socket.io gives CORS error even if I allowed cors it on server
<p>My node server and client are running on different ports(3001,5347 respectively).
On client I had used,</p>

<pre><code>var socket = io('http://127.0.0.1:3001');
</code></pre>

<p>On server I tried all of following one by one</p>

<pre><code>    1) io.set('origins', '*:*');
    2) io.set('origins', 'http://127.0.0.1:5347');
    3) io.set('origins', '*');
    4) io.set('origins', '127.0.0.1:5347');
</code></pre>

<p>But I'm getting following error:</p>

<blockquote>
  <p>XMLHttpRequest cannot load <a href="http://127.0.0.1:3001/socket.io/?EIO=3&amp;transport=polling&amp;t=1456799439856-4590" rel="noreferrer">http://127.0.0.1:3001/socket.io/?EIO=3&amp;transport=polling&amp;t=1456799439856-4590</a>. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'null' is therefore not allowed access.</p>
</blockquote>

<p>Note: I'm using express on server and I'm already using cors middleware in following way:</p>

<pre><code>app.use(cors());
</code></pre>

<p>Where app and cors are instances of express and cors respectively.</p>