While I have been searching for different alternatives to emit or broadcast with socket.io, the solution is quite simple. Use global variable to access it.
Global variable
For example in my www (or server.js) file.
Simple solution would be
And access from different file that's been loaded with require for example /routes/users.js
io variable will be simple accessible and able to send from any file you’re in.
Alternative solution for the paranoids
NPM install extra requirements
uuid
Well that's it.
Alternative Solution: Passing socket.io as argument