strophe / strophejs-plugin-mam Goto Github PK
View Code? Open in Web Editor NEWA Strophe.js plugin for message archive management (XEP-0313)
License: MIT License
A Strophe.js plugin for message archive management (XEP-0313)
License: MIT License
i want to get offline messages, and i have used mam for that but i'm getting error like
Uncaught TypeError: Cannot read property 'query' of undefined
at connection.mam.query and TypeError: connection.mam is undefined
sometimes, i have installed strophejs-plugin-mam and strophejs-plugin-rsm plugins but still the error is not resolved. my code which i have used is at below
connection.mam.query(Strophe.getBareJidFromJid(connection.jid), {
"with": $scope.to_id, "before": '', "max": '',
onMessage: function (message) {
console.log("Message from ", $(message).find("forwarded message").attr("from"),
": ", $(message).find("forwarded message body").text());
return true;
},
onComplete: function (response) {
console.log("Got all the messages");
}
});
Hello I'm getting the error. I have used this function on Strophe connection object.
here it's connection object this.connection = new Strophe.Connection(this.BOSH_SERVICE, { keepalive: true, });
here is the example -
this.connection.mam.query("[email protected]", { "with": "[email protected]", onMessage: function(message) { console.log("Message from ", $(message).find("forwarded message").attr("from"), ": ", $(message).find("forwarded message body").text()); return true; }, onComplete: function(response) { console.log("Got all the messages"); } });
getting below error.
var toJid = to + '@' + xmpp_ServerConnection.domain;
var fromJid = '53e1853e-fd47-429a-9d66-6a4285e8a650' + '@' + xmpp_ServerConnection.domain;
xmpp_ServerConnection.mam.query(fromJid, {
"with": toJid,
onMessage: function (message) {
console.log("Message from ", $(message).find("forwarded message").attr("from"),
": ", $(message).find("forwarded message body").text());
return true;
},
onComplete: function (response) {
console.log("Got all the messages");
}
});
I tried with above code getting error in debug logs, error is given below,
2017-12-20 15:24:55.895 [debug] <0.30102.2>@ejabberd_http_bind:send_outpacket:1043 --- outgoing data ---
<body
xmlns='http://jabber.org/protocol/httpbind'>
<iq
xmlns='jabber:client' from='[email protected]' to='[email protected]/web_4806_1513591677324' type='error' id='d4a0173f-f3cc-45b7-8915-902a5bce8bd6: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>
</x>
<set
xmlns='http://jabber.org/protocol/rsm'/>
</query>
<error code='503' type='cancel'>
<service-unavailable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>No module is handling this query
</text>
</error>
</iq>
</body>
Can anyone help me in this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.