My node server and client are running on different ports(3001,5347 respectively). On client I had used,
var socket = io('http://127.0.0.1:3001');
On server I tried all of following one by one
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');
But I'm getting following error:
XMLHttpRequest cannot load http://127.0.0.1:3001/socket.io/?EIO=3&transport=polling&t=1456799439856-4590. 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.
Note: I'm using express on server and I'm already using cors middleware in following way:
app.use(cors());
Where app and cors are instances of express and cors respectively.