engine.io-client
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -123,3 +123,2 @@ (function(){var global = this; | ||
if (window.localStorage) debug.enable(localStorage.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){ | ||
/** | ||
@@ -131,3 +130,3 @@ * Client version. | ||
exports.version = '0.3.3'; | ||
exports.version = '0.3.7'; | ||
@@ -548,3 +547,3 @@ /** | ||
, debug = require('debug')('engine-client:socket') | ||
, EventEmitter = require('./event-emitter') | ||
, EventEmitter = require('./event-emitter'); | ||
@@ -574,5 +573,5 @@ /** | ||
opts = opts || {}; | ||
this.secure = opts.secure || false; | ||
this.secure = null != opts.secure ? opts.secure : (global.location && 'https:' == global.location.protocol); | ||
this.host = opts.host || opts.hostname || 'localhost'; | ||
this.port = opts.port || 80; | ||
this.port = opts.port || (this.secure ? 443 : 80); | ||
this.query = opts.query || {}; | ||
@@ -611,3 +610,3 @@ this.query.uid = rnd(); | ||
debug('creating transport "%s"', name); | ||
var query = clone(this.query) | ||
var query = clone(this.query); | ||
query.transport = name; | ||
@@ -688,3 +687,3 @@ | ||
self.onClose('transport close'); | ||
}) | ||
}); | ||
}; | ||
@@ -702,3 +701,3 @@ | ||
var transport = this.createTransport(name, { probe: 1 }) | ||
, self = this | ||
, self = this; | ||
@@ -807,3 +806,3 @@ transport.once('open', function () { | ||
return packet.data; | ||
} | ||
}; | ||
this.onmessage && this.onmessage.call(this, event); | ||
@@ -845,3 +844,3 @@ break; | ||
Socket.prototype.onHeartbeat = function(){ | ||
Socket.prototype.onHeartbeat = function (timeout) { | ||
clearTimeout(this.pingTimeoutTimer); | ||
@@ -852,3 +851,3 @@ var self = this; | ||
self.onClose('ping timeout'); | ||
}, this.pingTimeout); | ||
}, timeout || (self.pingInterval + self.pingTimeout)); | ||
}; | ||
@@ -866,7 +865,6 @@ | ||
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'); | ||
self.onHeartbeat(self.pingTimeout); | ||
}, self.pingInterval); | ||
@@ -882,4 +880,4 @@ }; | ||
Socket.prototype.flush = function () { | ||
if ('closed' != this.readyState && this.transport.writable | ||
&& !this.upgrading && this.writeBuffer.length) { | ||
if ('closed' != this.readyState && this.transport.writable && | ||
!this.upgrading && this.writeBuffer.length) { | ||
debug('flushing %d packets in socket', this.writeBuffer.length); | ||
@@ -1374,3 +1372,3 @@ this.transport.send(this.writeBuffer); | ||
, flashsocket = require('./flashsocket') | ||
, util = require('../util') | ||
, util = require('../util'); | ||
@@ -1398,5 +1396,12 @@ /** | ||
if (global.location) { | ||
xd = opts.host != global.location.hostname | ||
|| global.location.port != opts.port; | ||
isXProtocol = (opts.secure !== (global.location.protocol === 'https:')); | ||
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; | ||
} | ||
@@ -1403,0 +1408,0 @@ |
(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){ | ||
/** | ||
@@ -9,3 +8,3 @@ * Client version. | ||
exports.version = '0.3.3'; | ||
exports.version = '0.3.7'; | ||
@@ -426,3 +425,3 @@ /** | ||
, debug = require('debug')('engine-client:socket') | ||
, EventEmitter = require('./event-emitter') | ||
, EventEmitter = require('./event-emitter'); | ||
@@ -452,5 +451,5 @@ /** | ||
opts = opts || {}; | ||
this.secure = opts.secure || false; | ||
this.secure = null != opts.secure ? opts.secure : (global.location && 'https:' == global.location.protocol); | ||
this.host = opts.host || opts.hostname || 'localhost'; | ||
this.port = opts.port || 80; | ||
this.port = opts.port || (this.secure ? 443 : 80); | ||
this.query = opts.query || {}; | ||
@@ -489,3 +488,3 @@ this.query.uid = rnd(); | ||
debug('creating transport "%s"', name); | ||
var query = clone(this.query) | ||
var query = clone(this.query); | ||
query.transport = name; | ||
@@ -566,3 +565,3 @@ | ||
self.onClose('transport close'); | ||
}) | ||
}); | ||
}; | ||
@@ -580,3 +579,3 @@ | ||
var transport = this.createTransport(name, { probe: 1 }) | ||
, self = this | ||
, self = this; | ||
@@ -685,3 +684,3 @@ transport.once('open', function () { | ||
return packet.data; | ||
} | ||
}; | ||
this.onmessage && this.onmessage.call(this, event); | ||
@@ -723,3 +722,3 @@ break; | ||
Socket.prototype.onHeartbeat = function(){ | ||
Socket.prototype.onHeartbeat = function (timeout) { | ||
clearTimeout(this.pingTimeoutTimer); | ||
@@ -730,3 +729,3 @@ var self = this; | ||
self.onClose('ping timeout'); | ||
}, this.pingTimeout); | ||
}, timeout || (self.pingInterval + self.pingTimeout)); | ||
}; | ||
@@ -744,7 +743,6 @@ | ||
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'); | ||
self.onHeartbeat(self.pingTimeout); | ||
}, self.pingInterval); | ||
@@ -760,4 +758,4 @@ }; | ||
Socket.prototype.flush = function () { | ||
if ('closed' != this.readyState && this.transport.writable | ||
&& !this.upgrading && this.writeBuffer.length) { | ||
if ('closed' != this.readyState && this.transport.writable && | ||
!this.upgrading && this.writeBuffer.length) { | ||
debug('flushing %d packets in socket', this.writeBuffer.length); | ||
@@ -1252,3 +1250,3 @@ this.transport.send(this.writeBuffer); | ||
, flashsocket = require('./flashsocket') | ||
, util = require('../util') | ||
, util = require('../util'); | ||
@@ -1276,5 +1274,12 @@ /** | ||
if (global.location) { | ||
xd = opts.host != global.location.hostname | ||
|| global.location.port != opts.port; | ||
isXProtocol = (opts.secure !== (global.location.protocol === 'https:')); | ||
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; | ||
} | ||
@@ -1281,0 +1286,0 @@ |
0.3.7 / 2012-10-21 | ||
================== | ||
* fix `version` [quackingduck] | ||
* ping timeout gets reset upon any packet received [indutny] | ||
* timeout fixes [cadorn, indutny] | ||
* transport: fix xdomain detection in absence of location.port (GH-38) | ||
* socket: fix passing `false` as secure getting overridden | ||
* socket: default `secure` to `true` for SSL-served pages | ||
* socket: fix default port for SSL when `secure` is not supplied | ||
0.3.6 / 2012-10-16 | ||
@@ -3,0 +14,0 @@ ================== |
@@ -1,2 +0,1 @@ | ||
/** | ||
@@ -8,3 +7,3 @@ * Client version. | ||
exports.version = '0.3.3'; | ||
exports.version = '0.3.7'; | ||
@@ -11,0 +10,0 @@ /** |
@@ -8,3 +8,3 @@ /** | ||
, debug = require('debug')('engine-client:socket') | ||
, EventEmitter = require('./event-emitter') | ||
, EventEmitter = require('./event-emitter'); | ||
@@ -34,5 +34,5 @@ /** | ||
opts = opts || {}; | ||
this.secure = opts.secure || false; | ||
this.secure = null != opts.secure ? opts.secure : (global.location && 'https:' == global.location.protocol); | ||
this.host = opts.host || opts.hostname || 'localhost'; | ||
this.port = opts.port || 80; | ||
this.port = opts.port || (this.secure ? 443 : 80); | ||
this.query = opts.query || {}; | ||
@@ -71,3 +71,3 @@ this.query.uid = rnd(); | ||
debug('creating transport "%s"', name); | ||
var query = clone(this.query) | ||
var query = clone(this.query); | ||
query.transport = name; | ||
@@ -148,3 +148,3 @@ | ||
self.onClose('transport close'); | ||
}) | ||
}); | ||
}; | ||
@@ -162,3 +162,3 @@ | ||
var transport = this.createTransport(name, { probe: 1 }) | ||
, self = this | ||
, self = this; | ||
@@ -267,3 +267,3 @@ transport.once('open', function () { | ||
return packet.data; | ||
} | ||
}; | ||
this.onmessage && this.onmessage.call(this, event); | ||
@@ -305,3 +305,3 @@ break; | ||
Socket.prototype.onHeartbeat = function(){ | ||
Socket.prototype.onHeartbeat = function (timeout) { | ||
clearTimeout(this.pingTimeoutTimer); | ||
@@ -312,3 +312,3 @@ var self = this; | ||
self.onClose('ping timeout'); | ||
}, this.pingTimeout); | ||
}, timeout || (self.pingInterval + self.pingTimeout)); | ||
}; | ||
@@ -326,7 +326,6 @@ | ||
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'); | ||
self.onHeartbeat(self.pingTimeout); | ||
}, self.pingInterval); | ||
@@ -342,4 +341,4 @@ }; | ||
Socket.prototype.flush = function () { | ||
if ('closed' != this.readyState && this.transport.writable | ||
&& !this.upgrading && this.writeBuffer.length) { | ||
if ('closed' != this.readyState && this.transport.writable && | ||
!this.upgrading && this.writeBuffer.length) { | ||
debug('flushing %d packets in socket', this.writeBuffer.length); | ||
@@ -346,0 +345,0 @@ this.transport.send(this.writeBuffer); |
@@ -10,3 +10,3 @@ | ||
, flashsocket = require('./flashsocket') | ||
, util = require('../util') | ||
, util = require('../util'); | ||
@@ -34,5 +34,12 @@ /** | ||
if (global.location) { | ||
xd = opts.host != global.location.hostname | ||
|| global.location.port != opts.port; | ||
isXProtocol = (opts.secure !== (global.location.protocol === 'https:')); | ||
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; | ||
} | ||
@@ -39,0 +46,0 @@ |
@@ -5,6 +5,7 @@ { | ||
"main": "./lib/engine.io-client", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"contributors": [ | ||
{ "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }, | ||
{ "name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com" } | ||
{ "name": "Vladimir Dronnikov", "email": "dronnikov@gmail.com" }, | ||
{ "name": "Christoph Dorn", "web": "https://github.com/cadorn" } | ||
], | ||
@@ -11,0 +12,0 @@ "dependencies": { |
@@ -1,2 +0,1 @@ | ||
# Engine.IO client | ||
@@ -93,3 +92,3 @@ | ||
- `query` (`Object`): optional query string addition (eg: `{ a: 'b' }`) | ||
- `secure` (`Boolean): whether the connection is secure | ||
- `secure` (`Boolean`): whether the connection is secure | ||
- `upgrade` (`Boolean`): defaults to true, whether the client should try | ||
@@ -96,0 +95,0 @@ to upgrade the transport from long-polling to something better. |
412643
13770
181