diff --git a/lib/server.js b/lib/server.js index cc779802..b4410434 100644 --- a/lib/server.js +++ b/lib/server.js @@ -57,26 +57,17 @@ Server.prototype.__proto__ = EventEmitter.prototype; Server.prototype.clients; /** - * Returns a list of available transports for upgrade. + * Returns a list of available transports for upgrade given a certain transport. * * @return {Array} * @api public */ -Server.prototype.upgrades = function () { - var available = this.transports - , upgrades = [] - - for (var i in transports) { - if (~available.indexOf(i) && transports[i].prototype.isUpgrade) { - upgrades.push(i); - } - } - - return upgrades; +Server.prototype.upgrades = function (transport) { + if (!this.allowUpgrades) return []; + return transports[transport].upgradesTo || []; }; - /** * Verifies a request. *