engine.io-client
Advanced tools
Comparing version 0.6.1 to 0.6.2
{ | ||
"name": "engine.io", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "component/emitter": "1.0.0", |
@@ -1152,3 +1152,3 @@ ;(function(){ | ||
/** | ||
* Sends a ping packet | ||
* Sends a ping packet. | ||
* | ||
@@ -1164,3 +1164,3 @@ * @api public | ||
* Called on `drain` event | ||
* | ||
* | ||
* @api private | ||
@@ -1170,5 +1170,11 @@ */ | ||
Socket.prototype.onDrain = function() { | ||
this.callbacks(); | ||
for (var i = 0; i < this.prevBufferLen; i++) { | ||
if (this.callbackBuffer[i]) { | ||
this.callbackBuffer[i](); | ||
} | ||
} | ||
this.writeBuffer.splice(0, this.prevBufferLen); | ||
this.callbackBuffer.splice(0, this.prevBufferLen); | ||
// setting prevBufferLen = 0 is very important | ||
@@ -1178,2 +1184,3 @@ // for example, when upgrading, upgrade packet is sent over, | ||
this.prevBufferLen = 0; | ||
if (this.writeBuffer.length == 0) { | ||
@@ -1184,19 +1191,5 @@ this.emit('drain'); | ||
} | ||
} | ||
}; | ||
/** | ||
* Calls all the callback functions associated with sending packets | ||
* | ||
* @api private | ||
*/ | ||
Socket.prototype.callbacks = function() { | ||
for (var i = 0; i < this.prevBufferLen; i++) { | ||
if (this.callbackBuffer[i]) { | ||
this.callbackBuffer[i](); | ||
} | ||
} | ||
} | ||
/** | ||
* Flush write buffers. | ||
@@ -1262,3 +1255,2 @@ * | ||
this.transport.close(); | ||
this.transport.removeAllListeners(); | ||
} | ||
@@ -1278,2 +1270,3 @@ | ||
this.emit('error', err); | ||
this.onerror && this.onerror.call(this, err); | ||
this.onClose('transport error', err); | ||
@@ -1292,4 +1285,7 @@ }; | ||
var self = this; | ||
// clear timers | ||
clearTimeout(this.pingIntervalTimer); | ||
clearTimeout(this.pingTimeoutTimer); | ||
// clean buffers in next tick, so developers can still | ||
@@ -1301,9 +1297,18 @@ // grab the buffers on `close` event | ||
}, 0); | ||
// ignore further transport communication | ||
this.transport.removeAllListeners(); | ||
// set ready state | ||
var prev = this.readyState; | ||
this.readyState = 'closed'; | ||
// clear session id | ||
this.id = null; | ||
// emit events | ||
if (prev == 'open') { | ||
this.emit('close', reason, desc); | ||
this.onclose && this.onclose.call(this); | ||
} | ||
this.onclose && this.onclose.call(this); | ||
this.id = null; | ||
} | ||
@@ -2030,4 +2035,18 @@ }; | ||
Polling.prototype.doClose = function(){ | ||
debug('sending close packet'); | ||
this.send([{ type: 'close' }]); | ||
var self = this; | ||
function close(){ | ||
debug('writing close packet'); | ||
self.write([{ type: 'close' }]); | ||
} | ||
if (this.open) { | ||
debug('transport open - closing'); | ||
close(); | ||
} else { | ||
// in case we're trying to close while | ||
// handshaking is in progress (GH-164) | ||
debug('transport not open - defering close'); | ||
this.once('open', close); | ||
} | ||
}; | ||
@@ -2701,2 +2720,19 @@ | ||
/** | ||
* Override `onData` to use a timer on iOS. | ||
* See: https://gist.github.com/mloughran/2052006 | ||
* | ||
* @api private | ||
*/ | ||
if ('undefined' != typeof navigator | ||
&& /iPad|iPhone|iPod/i.test(navigator.userAgent)) { | ||
WS.prototype.onData = function(data){ | ||
var self = this; | ||
setTimeout(function(){ | ||
Transport.prototype.onData.call(self, data); | ||
}, 0); | ||
}; | ||
} | ||
/** | ||
* Writes data to socket. | ||
@@ -2745,3 +2781,3 @@ * | ||
Transport.prototype.onClose.call(this); | ||
} | ||
}; | ||
@@ -2748,0 +2784,0 @@ /** |
0.6.2 / 2013-06-15 | ||
================== | ||
* transports: improve polling orderly close (fixes #164) | ||
* socket: ignore further transport communication upon `onClose` | ||
* socket: added missing `socket#onerror` support | ||
* socket: don't call `socket#onclose` if previous state was not `open` | ||
* transports: fix iOS5 crash issue | ||
* Makefile: extra precaution when building to avoid 0.6.0 build problem | ||
0.6.1 / 2013-06-06 | ||
@@ -3,0 +13,0 @@ ================== |
@@ -427,3 +427,3 @@ /** | ||
/** | ||
* Sends a ping packet | ||
* Sends a ping packet. | ||
* | ||
@@ -439,3 +439,3 @@ * @api public | ||
* Called on `drain` event | ||
* | ||
* | ||
* @api private | ||
@@ -445,5 +445,11 @@ */ | ||
Socket.prototype.onDrain = function() { | ||
this.callbacks(); | ||
for (var i = 0; i < this.prevBufferLen; i++) { | ||
if (this.callbackBuffer[i]) { | ||
this.callbackBuffer[i](); | ||
} | ||
} | ||
this.writeBuffer.splice(0, this.prevBufferLen); | ||
this.callbackBuffer.splice(0, this.prevBufferLen); | ||
// setting prevBufferLen = 0 is very important | ||
@@ -453,2 +459,3 @@ // for example, when upgrading, upgrade packet is sent over, | ||
this.prevBufferLen = 0; | ||
if (this.writeBuffer.length == 0) { | ||
@@ -459,19 +466,5 @@ this.emit('drain'); | ||
} | ||
} | ||
}; | ||
/** | ||
* Calls all the callback functions associated with sending packets | ||
* | ||
* @api private | ||
*/ | ||
Socket.prototype.callbacks = function() { | ||
for (var i = 0; i < this.prevBufferLen; i++) { | ||
if (this.callbackBuffer[i]) { | ||
this.callbackBuffer[i](); | ||
} | ||
} | ||
} | ||
/** | ||
* Flush write buffers. | ||
@@ -537,3 +530,2 @@ * | ||
this.transport.close(); | ||
this.transport.removeAllListeners(); | ||
} | ||
@@ -553,2 +545,3 @@ | ||
this.emit('error', err); | ||
this.onerror && this.onerror.call(this, err); | ||
this.onClose('transport error', err); | ||
@@ -567,4 +560,7 @@ }; | ||
var self = this; | ||
// clear timers | ||
clearTimeout(this.pingIntervalTimer); | ||
clearTimeout(this.pingTimeoutTimer); | ||
// clean buffers in next tick, so developers can still | ||
@@ -576,9 +572,18 @@ // grab the buffers on `close` event | ||
}, 0); | ||
// ignore further transport communication | ||
this.transport.removeAllListeners(); | ||
// set ready state | ||
var prev = this.readyState; | ||
this.readyState = 'closed'; | ||
// clear session id | ||
this.id = null; | ||
// emit events | ||
if (prev == 'open') { | ||
this.emit('close', reason, desc); | ||
this.onclose && this.onclose.call(this); | ||
} | ||
this.onclose && this.onclose.call(this); | ||
this.id = null; | ||
} | ||
@@ -585,0 +590,0 @@ }; |
@@ -161,4 +161,18 @@ /** | ||
Polling.prototype.doClose = function(){ | ||
debug('sending close packet'); | ||
this.send([{ type: 'close' }]); | ||
var self = this; | ||
function close(){ | ||
debug('writing close packet'); | ||
self.write([{ type: 'close' }]); | ||
} | ||
if (this.open) { | ||
debug('transport open - closing'); | ||
close(); | ||
} else { | ||
// in case we're trying to close while | ||
// handshaking is in progress (GH-164) | ||
debug('transport not open - defering close'); | ||
this.once('open', close); | ||
} | ||
}; | ||
@@ -165,0 +179,0 @@ |
@@ -77,2 +77,19 @@ /** | ||
/** | ||
* Override `onData` to use a timer on iOS. | ||
* See: https://gist.github.com/mloughran/2052006 | ||
* | ||
* @api private | ||
*/ | ||
if ('undefined' != typeof navigator | ||
&& /iPad|iPhone|iPod/i.test(navigator.userAgent)) { | ||
WS.prototype.onData = function(data){ | ||
var self = this; | ||
setTimeout(function(){ | ||
Transport.prototype.onData.call(self, data); | ||
}, 0); | ||
}; | ||
} | ||
/** | ||
* Writes data to socket. | ||
@@ -121,3 +138,3 @@ * | ||
Transport.prototype.onClose.call(this); | ||
} | ||
}; | ||
@@ -124,0 +141,0 @@ /** |
{ | ||
"name": "engine.io-client", | ||
"description": "Client for the realtime Engine", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"homepage": "https://github.com/LearnBoost/engine.io-client", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
Sorry, the diff of this file is not supported yet
397796
12877