In first file I have:
const io = require('socket.io')(process.env.IO_PORT);
io.on('connection', socket => {
socket.on('user.go', data => {
console.log('go');
}
}
In second file I need to access socket
object from callback. How can I export it and use it in another file. Code:
socket.emit(`add.message`, {
sender
});
Please advise!