信息 - 未处理 socket.io url
info - unhandled socket.io url
我正在尝试使用套接字连接到我在 运行 本地的节点服务器
但我一直在服务器端获得 'info - unhandled socket.io url'
+
"XMLHttpRequest cannot load http://localhost:8080/socket.io/?EIO=3&transport=polling&t=1424356590540-0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access."
chrome(使用地址 localhost:8000/index.html
)
// top six lines of code to see setup
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
io = require('socket.io').listen(server);
server.listen(8080);
我还在端口 8000 上使用 python SimpleHTTPServer
客户代码是:
var socket = io.connect('http://localhost:8080');
socket.on('connection', function(){
console.log("connected")
});
使用 https://cdn.socket.io/socket.io-1.3.4.js" 版本的 sockets.io
我假设 html 是无关紧要的,因为我没有任何 javascript 代码(除了对 angular 和 jquery 的引用)
我正在尝试使用套接字连接到我在 运行 本地的节点服务器
但我一直在服务器端获得 'info - unhandled socket.io url'
+
"XMLHttpRequest cannot load http://localhost:8080/socket.io/?EIO=3&transport=polling&t=1424356590540-0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access."
chrome(使用地址 localhost:8000/index.html
)
// top six lines of code to see setup
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
io = require('socket.io').listen(server);
server.listen(8080);
我还在端口 8000 上使用 python SimpleHTTPServer
客户代码是:
var socket = io.connect('http://localhost:8080');
socket.on('connection', function(){
console.log("connected")
});
使用 https://cdn.socket.io/socket.io-1.3.4.js" 版本的 sockets.io
我假设 html 是无关紧要的,因为我没有任何 javascript 代码(除了对 angular 和 jquery 的引用)