strophe.archive.js example

301 views
Skip to first unread message

David Pilkington

unread,
Aug 12, 2015, 10:24:24 AM8/12/15
to Strophe
I am trying to use this library but I cannot find any documenation on it. The examples that are provided on the GitHub page do not work.

I have  a Strophe connection stored uin an object and it is initialised like this: 

    login: function()
    {
      var conn = new Strophe.Connection("http://<<MYSERVER>>/http-bind");
      var jid = document.getElementById("jid").value;
      var password = document.getElementById("password").value;
      conn.connect(jid, password , function (status) {
          if (status === Strophe.Status.CONNECTED) {
              app.on_connected();
          } else if (status === Strophe.Status.DISCONNECTED) {
            alert("Disconnected");
            } else if (status === Strophe.Status.ERROR) {
              alert('status ERROR');
            } else if (status === Strophe.Status.CONNECTING) {
            } else if (status === Strophe.Status.CONNFAIL) {
              alert('status CONNFAIL');
            } else if (status === Strophe.Status.AUTHENTICATING) {
            } else if (status === Strophe.Status.AUTHFAIL) {
              alert('status AUTHFAIL');
            }
      });
      app.current_user = jid;
      app.connection = conn;
    }

I then try to initialise the archive library like this

app.connection.archive.init(app.connection);

and them make this call

      app.connection.archive.listCollections(app.current_user, rsm, function (collections, responseRsm) {
              //get last collection
              var lastCollection = collections[collections.length - 1];
              //get last 10 msgs (or all if you please)
              rsm = new Strophe.RSM({ 'max': 10, 'before': '' });
              lastCollection.retrieveMessages(rsm, function (messages, responseRsm) {
                   alert("Messages!");
               });
      }); 

But nothing happens. What am I doing wrong?

What are the parameters that are passed into 'listCollections'? Is it the currently logged in users JID or the persons who chat history you are trying to fetch?
 

Daniel Goldberg

unread,
Aug 12, 2015, 11:14:33 AM8/12/15
to str...@googlegroups.com
What server are you using ?
Do you have enable archive feature?



--
You received this message because you are subscribed to the Google Groups "Strophe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strophe+u...@googlegroups.com.
To post to this group, send email to str...@googlegroups.com.
Visit this group at http://groups.google.com/group/strophe.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------
Saludos, Daniel Goldberg.
Reply all
Reply to author
Forward
0 new messages