Socket IO V0.7: Where to put flashsockets SWF file?
I currently have my 'WebSocketMain.swf' file sitting in the same directory as 'socket.io.min.js' but Firefox doesn't seem to want to use flash sockets. It always reverts to XHR-Polling. See test case here : http://thebeer.co/labs/rt/test.php (page is blank, check JS console for feedback).
Is this the right place for it?
Do I need to direct Socket.io to the location of this SWF file?
UPDATE:
My node server requesting minified client js.
var $ = require('jquery');
var http = require('http'),
url = require('url'),
https = require('https'),
fs = require('fs'),
crypto = require('crypto'),
io = require('../'),
sys = require(process.binding('natives').util ? 'util' : 'sys'),
server = http.createServer(function(req, res){
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end();
});
server.listen(80,"173.201.181.56");
var io = io.listen(server), buffer=[];
io.set('browser client minification', true);//<<minified client js requested here.
My client side including the minified JS:
<script src="http://173.201.181.56:60/socket.io/socket.io.js">&开发者_C百科lt;/script>
I see that you decided to host the file your self. Did you know that Socket.IO also serves the client for you? See https://github.com/LearnBoost/Socket.IO/wiki/How-do-I-serve-the-client
You can even configure it, so it outputs a minified build: https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO
This client also knows where the location of the .swf file is, so you don't need to configure anything.
If you still want to serve the file your self (which is not recommended) You need to set the window.WEB_SOCKET_SWF_LOCATION
to http://yoururlhere.com:port/socket.io/static/flashsocket/WebSocketMain.swf
or WebSocketInsecure.swf (this depends if you go cross domain or port, but the bundled socket.io client handles this already for you)
精彩评论