Socket.io is not working after deployment

Hi, I am not sure it is related to Netlify,
but socket.io is not working after deployment…

It is a MERN app and it did worked at localhost address,
but after deployed via both Heroku and Netlify,
everything is working except Socket.io.

When clicking the main “Message Box” button after sign up,
the below error message will show in console.
"GET https://addressp/socket.io/?EIO=4&transport=polling&t=NeSQBN_ 404
polling-xhr.js:198 "

My backend code is:
const app = express()
const server = http.createServer(app)
var io = socketiO(server,{ cors:{origin: “*”}})
io.set(“transports”, [“polling”])
io.on(“connection”,(socket)=>{
socket.on(“Join”, async({sender})=>{…

My frontend code is:
socket = io(“https://herokuappaddess”, {
transports: [“polling”],
upgrade: false,
forceNew: true
})

For transports part, i tried both websocket(wss) and polling,
but both were not worked…

Could you kindly advise how to fix this if there were similar cases before?
Thank you for your help!

Hi @sjeong77,

Welcome to the Netlify community

There are several posts covering Socket.IO on this form search which might help answer your question.