Moved Socket.io setup into object