To fix Socket.io and Node.js Cross-Origin request blocked, we add a cors
option into the server.
For instance, we write
const io = require("socket.io")(server, {
cors: {
origin: "*",
},
});
to set the cors.origin
property to allow connection from all origins.