javascript - XMPP receive only one message at a time -


this code in javascript:

var user = {}; var handlerreference = null;  var mymessages = myapp.messages('.messages', {     autolayout: true });  function setlistener(name, jid) {     user.name = name;     user.jid = jid;      $("#chatscreentitle").text(user.name);     handlerreference = connection.addhandler(onmsgreceive, null, 'message', "chat", null, user.jid, {matchbare: true}); }  function onmsgreceive(stanza) {     console.log($(stanza).children("body").text());     mymessages.addmessage({         text: $(stanza).children("body").text(),         type: "received"     }, 'append', true); }  function sendmessage(message) {     if (message.length == 0) {         myapp.alert("please enter text", "alert");     }     else {         var uniqueid = connection.getuniqueid("my:code");                      var reqchannelsitems = $msg({id: uniqueid, to: user.jid, from: xmpp_user + "@" + xmpp_domain, type: "chat"}).c("body").t(message);         connection.send(reqchannelsitems.tree());          mymessages.addmessage({             text: message,             type: "sent"         }, 'append', true);     } } 

i can send , receive 1 message after not able send or receive messsage.

thanks.

i think need use return true @ end of onmsgreceive. if don't return true finish handler


Comments