nodejs-socketio-chat
nodejs-socketio-chat copied to clipboard
run file:///C:/soft/nodews/client/index.html , chrome not work ,but 360 browser(Webkit and Trident) is ok
Failed to load http://127.0.0.1:3000/socket.io/?EIO=3&transport=polling&t=MAP6H5v: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.
打开server的源码index.js,找到第3行,改为
var io = require('socket.io')(http, { cors: true });
原理就是允许socket.io跨域 或者用nginx也可以