sorry, it might be a simple question, and i did researched all day along.. but still couldn't find a solution..
I deployed MERN app via Netlify and Heroku, and everything is working except Socket.io.
My code is like below..
for server side,
const app = express()
var httpsOptions = {
key: fs.readFileSync("./test-key.pem"),
cert: fs.readFileSync("./test-cert.crt"),
ca: fs.readFileSync("./test_ca.crt"),
requestCert:false,
rejectUnauthorized: false
}
const server = https.createServer(httpsOptions, app)
var io = socketiO(server)
io.on("connection",(socket)=>{
socket.on("Join", async({sender})=>{
console.log("connection accepted")
for client side:
socket = io("https://herokusiteaddress")
socket.emit("connection")
socket.emit("Join", {sender})
And it gives error message:
Get https://netlifyappaddress/socket.io/?EIO=4&transport=polling&t=NePfNTm 404
polling-xhr, js:198
Does anyone know how to fix this..? I am newbie on the deployment.. Thank you for your help!