moving socket.io logic into a separate file