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\'); >
var socket = io(\'http://127.0.0.1:3001\');
If you are using Express then define a middleware like this before your serve start code...
app.use(function(request, response, next) { response.header("Access-Control-Allow-Origin", "*"); response.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); });