I'm stuck with the newer version of socket.io. Everything was fine but when I wanted to upgrade to socket.io 3, everything just broke, and currently on the client, I'm getting a 400 HTTP status code with the following JSON response -
{"code":5,"message":"Unsupported protocol version"}
Server-side config -
const io = require("socket.io")(server, {
cors: {
origin: config.clientURL,
methods: ["GET", "POST"],
credentials: true,
},
});
Client-side config -
const socket = io(backendURL, {
withCredentials: true,
});
I've tried very many things and redeployed many times but the error didn't go away.
For reference, I've these github repos -
Client in react.js - GitHub repo
Server in nodeJs and socket.io.js - GitHub repo