diff --git a/lib/server.js b/lib/server.js index 644d6b9ef..0d09afb90 100644 --- a/lib/server.js +++ b/lib/server.js @@ -229,7 +229,7 @@ class Server extends EventEmitter { * @api private */ async handshake(transportName, req) { - const protocol = req._query.EIO === "3" ? 3 : 4; // 4th revision by default + const protocol = req._query.EIO === "4" ? 4 : 3; // 3rd revision by default (this makes engine.io truly backward compatible) if (protocol === 3 && !this.opts.allowEIO3) { debug("unsupported protocol version"); sendErrorMessage( diff --git a/lib/transport.js b/lib/transport.js index 7fb2603a5..461bda2fc 100644 --- a/lib/transport.js +++ b/lib/transport.js @@ -22,8 +22,8 @@ class Transport extends EventEmitter { super(); this.readyState = "open"; this.discarded = false; - this.protocol = req._query.EIO === "3" ? 3 : 4; // 4th revision by default - this.parser = this.protocol === 3 ? parser_v3 : parser_v4; + this.protocol = req._query.EIO === "4" ? 4 : 3; // 3rd revision by default (this makes engine.io truly backward compatible) + this.parser = this.protocol === 4 ? parser_v4 : parser_v3; } /**