diff --git a/lib/socket.js b/lib/socket.js index a4d6ff44..31e8552a 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -364,7 +364,7 @@ Socket.prototype.onHandshake = function (data) { this.emit('handshake', data); this.id = data.sid; this.transport.query.sid = data.sid; - this.upgrades = data.upgrades; + this.upgrades = this.filterUpgrades(data.upgrades); this.pingInterval = data.pingInterval; this.pingTimeout = data.pingTimeout; this.onOpen(); @@ -498,6 +498,22 @@ Socket.prototype.onClose = function (reason, desc) { } }; +/** + * Filters upgrades, returning only those matching client transports. + * + * @param {Array} server upgrades + * @api private + * + */ + +Socket.prototype.filterUpgrades = function (upgrades) { + var filteredUpgrades = []; + for (var i = 0, j = upgrades.length; i