optmize the loop when listening XMPP server response