[英]Rails 3.1 working with Socket.io/Juggernaut on Ubuntu 11.10
I couldn't get Juggernaut/Socket.IO running on Windows so I took a shot at getting it running on Linux. 我无法让Juggernaut / Socket.IO在Windows上运行,所以我试图让它在Linux上运行。 I don't know much Linux (or Rails for that matter).
我不太了解Linux(或Rails)。 I can't get Socket.io/Juggernaut working on my Rails server.
我无法让Socket.io/Juggernaut在我的Rails服务器上工作。 It works OK on OS X (so I know it's working).
它在OS X上运行正常(所以我知道它正在工作)。
After everything installed, I do the following: 安装完所有后,我会执行以下操作:
/rails/app/path/rails s
redis-server
juggernaut # output is: info - socket.io started
So I'm guessing that works OK. 所以我猜这很好用。 Now, when I run a window that uses Juggernaut, I get the following error in the Chrome Javascript Console:
现在,当我运行一个使用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
Software information: 软件信息:
This looks like a CORS issue, where the browser won't allow an AJAX request to another origin (in this case port 8080). 这看起来像一个CORS问题,浏览器不允许向另一个源(在本例中为端口8080)发出AJAX请求。
You might need to set your CORS headers in Socket.IO. 您可能需要在Socket.IO中设置CORS头。
I found this answer: https://stackoverflow.com/a/10423354/351937 我找到了这个答案: https : //stackoverflow.com/a/10423354/351937
To find out more about CORS, have a look here: http://enable-cors.org/ and Google of course. 要了解有关CORS的更多信息,请查看此处: http : //enable-cors.org/和Google。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.