engine.io-client
Advanced tools
Comparing version 0.7.6 to 0.7.7
{ | ||
"name": "engine.io", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"dependencies": { | ||
@@ -9,2 +9,3 @@ "component/emitter": "1.0.1", | ||
"component/has-cors": "1.0.2", | ||
"component/ws": "1.0.0", | ||
"LearnBoost/engine.io-protocol": "0.3.0", | ||
@@ -11,0 +12,0 @@ "visionmedia/debug": "*" |
0.7.7 / 2013-08-30 | ||
================== | ||
* package: bump ws to 0.4.30 | ||
* websocket: no more env sniffing, just require `ws` [TooTallNate] | ||
* websocket: remove the "bufferedAmount" checking logic [TooTallNate] | ||
0.7.6 / 2013-08-30 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -6,2 +6,3 @@ /** | ||
var Transport = require('../transport') | ||
, WebSocket = require('ws') | ||
, parser = require('engine.io-parser') | ||
@@ -61,10 +62,7 @@ , util = require('../util') | ||
var self = this; | ||
var uri = this.uri(); | ||
var protocols = []; | ||
var opts = { agent: this.agent }; | ||
var uri = this.uri(); | ||
if (global.process && global.process.versions && global.process.versions.node) { | ||
// the user provided an explicit `http.Agent` instance (or `false`) to use | ||
this.socket = new (ws())(uri, { agent: this.agent }); | ||
} else { | ||
this.socket = new (ws())(uri); | ||
} | ||
this.socket = new WebSocket(uri, protocols, opts); | ||
this.socket.onopen = function(){ | ||
@@ -120,15 +118,5 @@ self.onOpen(); | ||
} | ||
// check periodically if we're done sending | ||
if ('bufferedAmount' in this.socket) { | ||
this.bufferedAmountId = setInterval(function() { | ||
if (self.socket.bufferedAmount == 0) { | ||
clearInterval(self.bufferedAmountId); | ||
ondrain(); | ||
} | ||
}, 50); | ||
} else { | ||
// fake drain | ||
// defer to next tick to allow Socket to clear writeBuffer | ||
setTimeout(ondrain, 0); | ||
} | ||
// fake drain | ||
// defer to next tick to allow Socket to clear writeBuffer | ||
setTimeout(ondrain, 0); | ||
}; | ||
@@ -143,4 +131,2 @@ | ||
WS.prototype.onClose = function(){ | ||
// stop checking to see if websocket is done sending buffer | ||
clearInterval(this.bufferedAmountId); | ||
Transport.prototype.onClose.call(this); | ||
@@ -201,18 +187,3 @@ }; | ||
WS.prototype.check = function(){ | ||
var websocket = ws(); | ||
return !!websocket && !('__initialize' in websocket && this.name === WS.prototype.name); | ||
return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name); | ||
}; | ||
/** | ||
* Getter for WS constructor. | ||
* | ||
* @api private | ||
*/ | ||
function ws(){ | ||
if ('undefined' == typeof window) { | ||
return require('ws'); | ||
} | ||
return global.WebSocket || global.MozWebSocket; | ||
} |
{ | ||
"name": "engine.io-client", | ||
"description": "Client for the realtime Engine", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"homepage": "https://github.com/LearnBoost/engine.io-client", | ||
@@ -23,3 +23,3 @@ "contributors": [ | ||
"has-cors": "https://github.com/component/has-cors/archive/v1.0.2.tar.gz", | ||
"ws": "0.4.25", | ||
"ws": "0.4.30", | ||
"xmlhttprequest": "https://github.com/LearnBoost/node-XMLHttpRequest/archive/0f36d0b5ebc03d85f860d42a64ae9791e1daa433.tar.gz", | ||
@@ -26,0 +26,0 @@ "emitter": "http://github.com/component/emitter/archive/1.0.1.tar.gz", |
@@ -103,4 +103,2 @@ | ||
describe('options', function () { | ||
console.log('¯\\_(ツ)_/¯'); | ||
return; | ||
it('should accept an `agent` option for WebSockets', function (done) { | ||
@@ -107,0 +105,0 @@ var polling = new eio.transports.websocket({ |
390454
12427