客户端代码(client.html):
var socket = io.connect('localhost:80');
服务端(server.js):
io = require('socket.io').listen("80",{origins:'*'});
在本地可以正常运行,放到本地服务器,提示
XMLHttpRequest cannot load http://localhost/socket.io/?E... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://jess.dev' is therefore not allowed access. The response had HTTP status code 404.