socket.io index refactor