On my server, I wanted to modularize my webapp\'s socket events. I did it like this:
server-socket.js
let io; let handler = require("./handler.js"