MERN APP with deployed on render not working

This is my server side code for socket intialization
const { createServer } = require(“http”);
const { Server } = require(“”);

const httpServer = createServer(app);
const io = new Server(httpServer, {
cors: {
origin: “https://ui-url”,
methods: [“GET”, “POST”],


This is my client side code for connecting to socket
useEffect(() => {

const s = io('');
console.log("socket", s);
return () => {

}, );

→ I get this error in my browser console, not able to establish, the socket connection ,can anyone help?
WebSocket connection to ‘wss://’ failed:

Hi Krishanu,

I’d suggest deploying this demo app to use as a reference implementation and then adapting it to mimic what exactly you may be facing with your service.