Socket emit inside functions

More than 1 year has passed since last update.
// config/lib/
  // Add an event listener to the 'connection' event
  io.on('connection', function (socket) {
    config.files.server.sockets.forEach(function (socketConfiguration) {
      require(path.resolve(socketConfiguration))(io, socket);

// added this line below
app.set('socketio', io);

return server;

Second, I load this variable as 'app.get' which is like snipplet below:

// any server controller file, I want to emit, 
// in my case, user.profile.server.controller.js
var io ='socketio');

io.emit('rom1', msg);