Socket.io Cross-reference request blocked

I am getting below message

Cross-origin request blocked: Same origin policy denies reading remote resource at? Http: ///socket.io/EIO = 3 & transport = poll & t = 1414700673061-7. This can be fixed by moving the resource to the same domain or enabling CORS.

I tried:

io.set( "origins", "*:*" );
io.sockets.on('connection', function (socket) { });

      

Where am I going wrong.

+3


source to share


1 answer


Don't forget to include the same address you have on your server, including the port:

"<" script ">"

var socket = io ('http: // localhost: 8080');



...

Remember, the socket on your server is different from the socket on your client.

0


source







All Articles