Files
socket.io/lib/transports/flashsocket.js
Guillermo Rauch 922a96d28c Opera 10 support
Some README fixes
 - Added API example at the top
 - Added opera
2010-08-31 13:05:41 -07:00

48 lines
1.5 KiB
JavaScript

/**
* Socket.IO client
*
* @author Guillermo Rauch <guillermo@learnboost.com>
* @license The MIT license.
* @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
*/
(function(){
var Flashsocket = io.Transport.flashsocket = function(){
io.Transport.websocket.apply(this, arguments);
};
io.util.inherit(Flashsocket, io.Transport.websocket);
Flashsocket.prototype.type = 'flashsocket';
Flashsocket.prototype._onClose = function(){
if (!this.base.connected){
// something failed, we might be behind a proxy, so we'll try another transport
this.base.options.transports.splice(io.util.indexOf(this.base.options.transports, 'flashsocket'), 1);
this.base.transport = this.base.getTransport();
this.base.connect();
return;
}
return io.Transport.websocket.prototype._onClose.call(this);
};
Flashsocket.check = function(){
if (!('path' in io)) throw new Error('The `flashsocket` transport requires that you call io.setPath() with the path to the socket.io client dir.');
if (io.util.opera) return false; // opera is buggy with this transport
if ('navigator' in window && 'plugins' in navigator && navigator.plugins['Shockwave Flash']){
return !!navigator.plugins['Shockwave Flash'].description;
}
if ('ActiveXObject' in window) {
try {
return !!new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
} catch (e) {}
}
return false;
};
Flashsocket.xdomainCheck = function(){
return true;
};
})();