Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: set default protocol version to 3 to allow backward compatibilit… #616

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions lib/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down