socket.io uest at 'http://localhost:3005/socket.io/?EIO=3&transport=polling&t=NSH7T-B' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 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);