After the first group message the strophe.muc plugin doesn't react on the following messages. I get the first presence, message and roster from the room, but all subsequent messages and presence stanzas will not trigger the functions. I think there is something wrong with the lines:
this.rooms[room].addHandler('message', msg_handler_cb);
this.rooms[room].addHandler('presence', pres_handler_cb);
this.rooms[room].addHandler('roster', roster_cb);
my code:
join: function(){
console.log("joining room");
var self = this;
connection.muc.join("[email protected]", "john", self.onMessage, self.onPresence, self.onRoster);
},
onMessage: function(message){
var self = this;
var body = $(message).text();
var from = $(message).attr("from");
console.log(body);
console.log(from);
},
onPresence: function(presence){
console.log("onPresence");
console.log(presence);
},
onRoster: function(roster){
console.log("onRoster");
console.log(roster);
},
Handlers that wish to continue being invoked should return true.
So just append return true; to all your handlers.
It's mentioned in the docs: http://strophe.im/strophejs/doc/1.0.2/files2/strophe-js.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With