socket io enable cors code example
Example 1: socket io with cors
const io = require("socket.io")(httpServer,
{
cors: {
origin: "*",
methods: ["GET", "POST"]
}});
Example 2: socket.io cors
const io = require("socket.io")(httpServer, { cors: { origin: "http://localhost:8080", methods: ["GET", "POST"] }});httpServer.listen(3000);
Example 3: CORS Socket io v2
const io = require('socket.io')(server, { origins: '*:*'});