From b60df56157ee1fd0bd4938799bac05a62fda91a1 Mon Sep 17 00:00:00 2001 From: lookshe Date: Sat, 14 Mar 2015 20:45:20 +0100 Subject: initial commit from working version --- .../lib/transports/index.js | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/learnboost-engine.io-client/lib/transports/index.js (limited to 'signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/learnboost-engine.io-client/lib/transports/index.js') diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/learnboost-engine.io-client/lib/transports/index.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/learnboost-engine.io-client/lib/transports/index.js new file mode 100644 index 0000000..374620b --- /dev/null +++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/components/learnboost-engine.io-client/lib/transports/index.js @@ -0,0 +1,62 @@ + +/** + * Module dependencies + */ + +var XHR = require('./polling-xhr') + , JSONP = require('./polling-jsonp') + , websocket = require('./websocket') + , flashsocket = require('./flashsocket') + , util = require('../util'); + +/** + * Export transports. + */ + +exports.polling = polling; +exports.websocket = websocket; +exports.flashsocket = flashsocket; + +/** + * Global reference. + */ + +var global = 'undefined' != typeof window ? window : global; + +/** + * Polling transport polymorphic constructor. + * Decides on xhr vs jsonp based on feature detection. + * + * @api private + */ + +function polling (opts) { + var xhr + , xd = false + , isXProtocol = false; + + if (global.location) { + var isSSL = 'https:' == location.protocol; + var port = location.port; + + // some user agents have empty `location.port` + if (Number(port) != port) { + port = isSSL ? 443 : 80; + } + + xd = opts.host != location.hostname || port != opts.port; + isXProtocol = opts.secure != isSSL; + } + + xhr = util.request(xd); + /* See #7 at http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx */ + if (isXProtocol && global.XDomainRequest && xhr instanceof global.XDomainRequest) { + return new JSONP(opts); + } + + if (xhr && !opts.forceJSONP) { + return new XHR(opts); + } else { + return new JSONP(opts); + } +}; -- cgit v1.2.3