Wait until the socket is connected before trying to listen to events