Rails 和 Socket.io (node.js)
我打算使用 Rails 应用程序来提供由 node.js 服务器和 Socket.io 处理的实时数据。
在 Socket.io 网站上,它说:
如果您不会利用 Node.JS 来提供服务 您的文件,请确保设置 全局
WEB_SOCKET_SWF_LOCATION
到 WebSocketMain.swf 的位置 文件。
如果我使用 Rails 来提供静态文件,这到底意味着什么?
另外,来自常见问题解答:
我想自己托管 Socket.IO 客户端:
如果您不依赖 Node.JS 为 Socket.IO 客户端提供服务 JavaScript 文件,请确保设置
WEB_SOCKET_SWF_LOCATION
右侧 包含 socket.io.js 后 WebSocketMain.swf 的位置 这是 Socket.IO 找到 Flash WebSocket 所需的 .swf 文件所必需的。
不过,我不太明白。
谢谢。
I intend to use a Rails app to serve real-time data processed by a node.js server and Socket.io.
In the Socket.io website, it says that:
If you won't leverage Node.JS to serve
your files, make sure to set the
globalWEB_SOCKET_SWF_LOCATION
to
the location of the WebSocketMain.swf
file.
What does it means exactly if I use rails to serve the static files?
Also, from the FAQ:
I want to host the Socket.IO client myself:
If you're not relying on Node.JS serving Socket.IO clientside
JavaScript files, make sure you set
theWEB_SOCKET_SWF_LOCATION
right
after including socket.io.js with the
location of the WebSocketMain.swf
This is required in order for Socket.IO to find the .swf file required for Flash WebSocket.
However, I don't quite get it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WebSocketMain.swf 文件用作基于 Flash 的套接字通信的一部分,这是 WebSocket 传输不可用时的后备解决方案之一。这是一个静态文件,默认情况下由 socket.io 内部提供服务。但是,如果您打算通过 RoR 应用程序提供此文件,则应设置 WEB_SOCKET_SWF_LOCATION 以便 socket.io 能够找到 WebSocketMain.swf 文件并在后备情况下使用它。
例如,如果您正在运行独立的 socket.io 服务器,那么它正在端口 8080 上运行,并从那里提供文件。但是,如果您添加在端口 80 上运行的 RoR,并且您还想使用 RoR 提供 socket.io 静态文件,那么您应该指示 socket.io 有关 WebSocketMain.swf 文件的位置,因为 RoR 使用不同的端口或路径服务它。
WebSocketMain.swf file is used as part of the Flash based socket communication which is one of the fallback solutions when WebSocket transport is not available. This is a static file and by default it is served internally by socket.io. However if you intend to serve this file with your RoR application, you should set the
WEB_SOCKET_SWF_LOCATION
in order to socket.io being able to locate the WebSocketMain.swf file and use it in fallback case.For example if you are running standalone socket.io server, it is running lets say on port 8080 and is serving files from there. However if you add RoR, which runs on port 80, and you want to serve also socket.io static files with RoR, then you should instruct socket.io about the location of WebSocketMain.swf file since RoR is using different port or path to serve it.