Rails and Socket.io (node.js)
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 global
WEB_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 the
WEB_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.
Ho开发者_JS百科wever, I don't quite get it.
Thanks.
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.
精彩评论