【发布时间】:2015-05-29 03:01:43
【问题描述】:
我在客户端有一个角度模块:
angular.module('App')
.factory('socketClient', function(socketFactory, Auth) {
// socket.io now auto-configures its connection when we ommit a connection url
var ioSocket = io('', {
// Send auth token on connection
query: 'token=' + Auth.getToken(),
path: '/socket.io-client'
});
return socketFactory({
ioSocket: ioSocket
});;
});
如果我想请求其他命名空间,我会进行下一个更改:
var ioSocket = io('/test', {
// Send auth token on connection
query: 'token=' + Auth.getToken(),
path: '/socket.io-client'
}
但是当我这样做时,我会在浏览器中获得以下登录信息。
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/socket.io-client/?token=&EIO=3&transport=polling&t=1432867748704-8. (Reason: CORS request failed).
我只是在连接到命名空间时收到此错误。
对不起我的英语。 c:
【问题讨论】:
标签: angularjs node.js firefox express socket.io