/js/lib/Socket.IO-node/support/socket.io-client/lib/transports/flashsocket.js
JavaScript | 54 lines | 38 code | 9 blank | 7 comment | 8 complexity | 6fdd850777d15ebdbb4ab0127d67301e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
- /**
- * Socket.IO client
- *
- * @author Guillermo Rauch <guillermo@learnboost.com>
- * @license The MIT license.
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
- */
- (function(){
- var io = this.io;
-
- 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.connect = function(){
- var self = this, args = arguments;
- WebSocket.__addTask(function(){
- io.Transport.websocket.prototype.connect.apply(self, args);
- });
- return this;
- };
-
- Flashsocket.prototype.send = function(){
- var self = this, args = arguments;
- WebSocket.__addTask(function(){
- io.Transport.websocket.prototype.send.apply(self, args);
- });
- return this;
- };
-
- Flashsocket.check = function(){
- if (typeof WebSocket == 'undefined' || !('__addTask' in WebSocket)) return false;
- 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;
- };
-
- })();