//app.js or index.js
const app = express();
var http = require("http");
var server=http.createServer(app).listen(2525, (req, res) => {
console.log("Server running on", 2525);
});
var socketIO = require("socket.io");
var io = socketIO(server);
global.io = io //Importent line
//Add the below statement to your controller code
global.io.emit("eventname", "yourdata"); //Importent line