我无法让Juggernaut / Socket.IO在Windows上运行,所以我试着让它在Linux上运行。我不太了解Linux(或Rails)。我无法让Socket.io/Juggernaut在我的Rails服务器上工作。它在OS X上运行正常(所以我知道它正在运行)。
安装完所有内容后,我会执行以下操作:
/rails/app/path/rails s
redis-server
juggernaut # output is: info - socket.io started
所以我猜这很好用。现在,当我运行一个使用Juggernaut的窗口时,我在Chrome Javascript控制台中收到以下错误:
XMLHttpRequest cannot load http://localhost:8080/socket.io/xhr-polling//1322359666443. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
Resource interpreted as Script but transferred with MIME type text/plain.
Uncaught SyntaxError: Unexpected identifier
软件信息:
答案 0 :(得分:0)
这看起来像一个CORS问题,浏览器不允许向另一个源(在本例中为端口8080)发出AJAX请求。
您可能需要在Socket.IO中设置CORS标头。
我找到了这个答案:https://stackoverflow.com/a/10423354/351937
要了解有关CORS的更多信息,请查看此处:http://enable-cors.org/和Google当然。