Skip to content

Commit 5e628b9

Browse files
authored
Adding error call back function with sendIQ()
this will help to get the error message response by server. If MAM service is not active in XMPP server, we will get the bellow kind of error message from server: <iq xmlns="jabber:client" from="[email protected]" to="[email protected]/0F892479AD63271A1558-938994-148287" type="error" xml:lang="en" id="1:sendIQ"> <query xmlns="urn:xmpp:mam:2"> <x xmlns="jabber:x:data" type="submit"> <field var="FORM_TYPE" type="hidden"> <value>urn:xmpp:mam:2</value> </field> <field var="with"> <value>[email protected]</value> </field> <field var="start"> <value>2017-05-23T00:00:00Z</value> </field> <field var="end"> <value>2017-05-26T00:00:00Z</value> </field> </x> <set xmlns="http://jabber.org/protocol/rsm"> <max /> <before /> </set> </query> <error code="503" type="cancel"> <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> </error> </iq>
1 parent 0ab80c2 commit 5e628b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/strophe.mam.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ Strophe.addConnectionPlugin('mam', {
5555
return this._c.sendIQ(iq, function(){
5656
_c.deleteHandler(handler);
5757
onComplete.apply(this, arguments);
58-
});
58+
},
59+
function(err){
60+
//error callBack function
61+
console.log("Error Response from server:", err);
62+
});
5963
}
6064
});

0 commit comments

Comments
 (0)