engine.io-client
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -130,3 +130,3 @@ (function(){var global = this; | ||
exports.version = '0.2.2'; | ||
exports.version = '0.3.0'; | ||
@@ -782,5 +782,4 @@ /** | ||
case 'ping': | ||
this.sendPacket('pong'); | ||
this.setPingTimeout(); | ||
case 'pong': | ||
this.ping(); | ||
break; | ||
@@ -820,9 +819,11 @@ | ||
this.upgrades = data.upgrades; | ||
this.pingInterval = data.pingInterval; | ||
this.pingTimeout = data.pingTimeout; | ||
this.onOpen(); | ||
this.setPingTimeout(); | ||
this.ping(); | ||
}; | ||
/** | ||
* Clears and sets a ping timeout based on the expected ping interval. | ||
* Pings server every `this.pingInterval` and expects response | ||
* within `this.pingTimeout` or closes connection. | ||
* | ||
@@ -832,8 +833,15 @@ * @api private | ||
Socket.prototype.setPingTimeout = function () { | ||
clearTimeout(this.pingTimeoutTimer); | ||
Socket.prototype.ping = function () { | ||
var self = this; | ||
this.pingTimeoutTimer = setTimeout(function () { | ||
self.onClose('ping timeout'); | ||
}, this.pingTimeout); | ||
clearTimeout(self.pingIntervalTimer); | ||
clearTimeout(self.pingTimeoutTimer); | ||
self.pingIntervalTimer = setTimeout(function () { | ||
debug('writing ping packet - expecting pong within %sms', self.pingTimeout); | ||
self.emit('heartbeat'); | ||
self.sendPacket('ping'); | ||
clearTimeout(self.pingTimeoutTimer); | ||
self.pingTimeoutTimer = setTimeout(function () { | ||
self.onClose('ping timeout'); | ||
}, self.pingTimeout); | ||
}, self.pingInterval); | ||
}; | ||
@@ -1356,3 +1364,5 @@ | ||
function polling (opts) { | ||
var xd = false; | ||
var xhr | ||
, xd = false | ||
, isXProtocol = false; | ||
@@ -1362,5 +1372,12 @@ if (global.location) { | ||
|| global.location.port != opts.port; | ||
isXProtocol = (opts.secure !== (global.location.protocol === 'https:')); | ||
} | ||
if (util.request(xd) && !opts.forceJSONP) { | ||
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); | ||
@@ -2049,4 +2066,5 @@ } else { | ||
// cache busting is forced for IE / android | ||
if (global.ActiveXObject || util.ua.android || this.timestampRequests) { | ||
// cache busting is forced for IE / android / iOS6 ಠ_ಠ | ||
if (global.ActiveXObject || util.ua.android || util.ua.ios6 | ||
|| this.timestampRequests) { | ||
query[this.timestampParam] = +new Date; | ||
@@ -2401,2 +2419,10 @@ } | ||
/** | ||
* Detect iOS. | ||
*/ | ||
exports.ua.ios = 'undefined' != typeof navigator && | ||
/^(iPad|iPhone|iPod)$/.test(navigator.platform); | ||
exports.ua.ios6 = exports.ua.ios && /OS 6_/.test(navigator.userAgent); | ||
/** | ||
* XHR request helper. | ||
@@ -2414,3 +2440,3 @@ * | ||
if (xdomain && 'undefined' != typeof XDomainRequest) { | ||
if (xdomain && 'undefined' != typeof XDomainRequest && !exports.ua.hasCORS) { | ||
return new XDomainRequest(); | ||
@@ -2417,0 +2443,0 @@ } |
@@ -9,3 +9,3 @@ (function(){var global = this;function debug(){return debug};function require(p, parent){ var path = require.resolve(p) , mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '" from ' + parent); if (!mod.exports) { mod.exports = {}; mod.call(mod.exports, mod, mod.exports, require.relative(path), global); } return mod.exports;}require.modules = {};require.resolve = function(path){ var orig = path , reg = path + '.js' , index = path + '/index.js'; return require.modules[reg] && reg || require.modules[index] && index || orig;};require.register = function(path, fn){ require.modules[path] = fn;};require.relative = function(parent) { return function(p){ if ('debug' == p) return debug; if ('.' != p.charAt(0)) return require(p); var path = parent.split('/') , segs = p.split('/'); path.pop(); for (var i = 0; i < segs.length; i++) { var seg = segs[i]; if ('..' == seg) path.pop(); else if ('.' != seg) path.push(seg); } return require(path.join('/'), parent); };};require.register("engine.io-client.js", function(module, exports, require, global){ | ||
exports.version = '0.2.2'; | ||
exports.version = '0.3.0'; | ||
@@ -661,5 +661,4 @@ /** | ||
case 'ping': | ||
this.sendPacket('pong'); | ||
this.setPingTimeout(); | ||
case 'pong': | ||
this.ping(); | ||
break; | ||
@@ -699,9 +698,11 @@ | ||
this.upgrades = data.upgrades; | ||
this.pingInterval = data.pingInterval; | ||
this.pingTimeout = data.pingTimeout; | ||
this.onOpen(); | ||
this.setPingTimeout(); | ||
this.ping(); | ||
}; | ||
/** | ||
* Clears and sets a ping timeout based on the expected ping interval. | ||
* Pings server every `this.pingInterval` and expects response | ||
* within `this.pingTimeout` or closes connection. | ||
* | ||
@@ -711,8 +712,15 @@ * @api private | ||
Socket.prototype.setPingTimeout = function () { | ||
clearTimeout(this.pingTimeoutTimer); | ||
Socket.prototype.ping = function () { | ||
var self = this; | ||
this.pingTimeoutTimer = setTimeout(function () { | ||
self.onClose('ping timeout'); | ||
}, this.pingTimeout); | ||
clearTimeout(self.pingIntervalTimer); | ||
clearTimeout(self.pingTimeoutTimer); | ||
self.pingIntervalTimer = setTimeout(function () { | ||
debug('writing ping packet - expecting pong within %sms', self.pingTimeout); | ||
self.emit('heartbeat'); | ||
self.sendPacket('ping'); | ||
clearTimeout(self.pingTimeoutTimer); | ||
self.pingTimeoutTimer = setTimeout(function () { | ||
self.onClose('ping timeout'); | ||
}, self.pingTimeout); | ||
}, self.pingInterval); | ||
}; | ||
@@ -1235,3 +1243,5 @@ | ||
function polling (opts) { | ||
var xd = false; | ||
var xhr | ||
, xd = false | ||
, isXProtocol = false; | ||
@@ -1241,5 +1251,12 @@ if (global.location) { | ||
|| global.location.port != opts.port; | ||
isXProtocol = (opts.secure !== (global.location.protocol === 'https:')); | ||
} | ||
if (util.request(xd) && !opts.forceJSONP) { | ||
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); | ||
@@ -1928,4 +1945,5 @@ } else { | ||
// cache busting is forced for IE / android | ||
if (global.ActiveXObject || util.ua.android || this.timestampRequests) { | ||
// cache busting is forced for IE / android / iOS6 ಠ_ಠ | ||
if (global.ActiveXObject || util.ua.android || util.ua.ios6 | ||
|| this.timestampRequests) { | ||
query[this.timestampParam] = +new Date; | ||
@@ -2280,2 +2298,10 @@ } | ||
/** | ||
* Detect iOS. | ||
*/ | ||
exports.ua.ios = 'undefined' != typeof navigator && | ||
/^(iPad|iPhone|iPod)$/.test(navigator.platform); | ||
exports.ua.ios6 = exports.ua.ios && /OS 6_/.test(navigator.userAgent); | ||
/** | ||
* XHR request helper. | ||
@@ -2293,3 +2319,3 @@ * | ||
if (xdomain && 'undefined' != typeof XDomainRequest) { | ||
if (xdomain && 'undefined' != typeof XDomainRequest && !exports.ua.hasCORS) { | ||
return new XDomainRequest(); | ||
@@ -2296,0 +2322,0 @@ } |
0.3.0 / 2012-09-04 | ||
================== | ||
* IE's XDomainRequest cannot do requests that go from HTTPS to HTTP or HTTP to HTTPS [mixu] | ||
* Switch to client-initiated ping, and set interval in handshake [cadorn] | ||
0.2.2 / 2012-08-26 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -8,3 +8,3 @@ | ||
exports.version = '0.2.2'; | ||
exports.version = '0.3.0'; | ||
@@ -11,0 +11,0 @@ /** |
@@ -243,5 +243,4 @@ /** | ||
case 'ping': | ||
this.sendPacket('pong'); | ||
this.setPingTimeout(); | ||
case 'pong': | ||
this.ping(); | ||
break; | ||
@@ -281,9 +280,11 @@ | ||
this.upgrades = data.upgrades; | ||
this.pingInterval = data.pingInterval; | ||
this.pingTimeout = data.pingTimeout; | ||
this.onOpen(); | ||
this.setPingTimeout(); | ||
this.ping(); | ||
}; | ||
/** | ||
* Clears and sets a ping timeout based on the expected ping interval. | ||
* Pings server every `this.pingInterval` and expects response | ||
* within `this.pingTimeout` or closes connection. | ||
* | ||
@@ -293,8 +294,15 @@ * @api private | ||
Socket.prototype.setPingTimeout = function () { | ||
clearTimeout(this.pingTimeoutTimer); | ||
Socket.prototype.ping = function () { | ||
var self = this; | ||
this.pingTimeoutTimer = setTimeout(function () { | ||
self.onClose('ping timeout'); | ||
}, this.pingTimeout); | ||
clearTimeout(self.pingIntervalTimer); | ||
clearTimeout(self.pingTimeoutTimer); | ||
self.pingIntervalTimer = setTimeout(function () { | ||
debug('writing ping packet - expecting pong within %sms', self.pingTimeout); | ||
self.emit('heartbeat'); | ||
self.sendPacket('ping'); | ||
clearTimeout(self.pingTimeoutTimer); | ||
self.pingTimeoutTimer = setTimeout(function () { | ||
self.onClose('ping timeout'); | ||
}, self.pingTimeout); | ||
}, self.pingInterval); | ||
}; | ||
@@ -301,0 +309,0 @@ |
@@ -28,3 +28,5 @@ | ||
function polling (opts) { | ||
var xd = false; | ||
var xhr | ||
, xd = false | ||
, isXProtocol = false; | ||
@@ -34,5 +36,12 @@ if (global.location) { | ||
|| global.location.port != opts.port; | ||
isXProtocol = (opts.secure !== (global.location.protocol === 'https:')); | ||
} | ||
if (util.request(xd) && !opts.forceJSONP) { | ||
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); | ||
@@ -39,0 +48,0 @@ } else { |
@@ -183,4 +183,5 @@ /** | ||
// cache busting is forced for IE / android | ||
if (global.ActiveXObject || util.ua.android || this.timestampRequests) { | ||
// cache busting is forced for IE / android / iOS6 ಠ_ಠ | ||
if (global.ActiveXObject || util.ua.android || util.ua.ios6 | ||
|| this.timestampRequests) { | ||
query[this.timestampParam] = +new Date; | ||
@@ -187,0 +188,0 @@ } |
@@ -177,2 +177,10 @@ | ||
/** | ||
* Detect iOS. | ||
*/ | ||
exports.ua.ios = 'undefined' != typeof navigator && | ||
/^(iPad|iPhone|iPod)$/.test(navigator.platform); | ||
exports.ua.ios6 = exports.ua.ios && /OS 6_/.test(navigator.userAgent); | ||
/** | ||
* XHR request helper. | ||
@@ -190,3 +198,3 @@ * | ||
if (xdomain && 'undefined' != typeof XDomainRequest) { | ||
if (xdomain && 'undefined' != typeof XDomainRequest && !exports.ua.hasCORS) { | ||
return new XDomainRequest(); | ||
@@ -193,0 +201,0 @@ } |
{ | ||
"name": "engine.io-client" | ||
, "description": "Client for the realtime Engine" | ||
, "main": "./lib/engine.io-client" | ||
, "version": "0.2.2" | ||
, "contributors": [ | ||
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } | ||
, { "name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com" } | ||
] | ||
, "dependencies": { | ||
"ws": "0.4.20" | ||
, "xmlhttprequest": "1.4.2" | ||
, "debug": "0.6.0" | ||
"name": "engine.io-client", | ||
"description": "Client for the realtime Engine", | ||
"main": "./lib/engine.io-client", | ||
"version": "0.3.0", | ||
"contributors": [ | ||
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }, | ||
{ "name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com" } | ||
], | ||
"dependencies": { | ||
"ws": "0.4.20", | ||
"xmlhttprequest": "1.5.0", | ||
"debug": "0.6.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"serve": "*", | ||
"expect.js": "*", | ||
"browserbuild": "*" | ||
}, | ||
"component": { | ||
"scripts": { | ||
"engine.io-client": "./dist/engine.io-dev.js" | ||
} | ||
, "devDependencies": { | ||
"mocha": "*" | ||
, "serve": "*" | ||
, "expect.js": "*" | ||
, "browserbuild": "*" | ||
} | ||
, "scripts" : { "test" : "make test" } | ||
} | ||
} |
409495
13713
+ Addedxmlhttprequest@1.5.0(transitive)
- Removedxmlhttprequest@1.4.2(transitive)
Updatedxmlhttprequest@1.5.0