Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting duplicates messages from mam query #122

Open
LTroya opened this issue Oct 12, 2015 · 0 comments
Open

Getting duplicates messages from mam query #122

LTroya opened this issue Oct 12, 2015 · 0 comments

Comments

@LTroya
Copy link

LTroya commented Oct 12, 2015

Is there a way to retrieve messages from two chats at the same time?

I try

[jid1, jid2].forEach(function (jid) {
    connect.mam.query(Strophe.getBareJidFromJid(connect.jid), getQuery(jid));
});

function getQuery(jid) {
        return {
            with: jid + '@domain.com',
            max: 5,
            before: '',
            onMessage: function (message) {
                  // my code
            },
            onComplete: function (response) {
                // my code
            }
        };
    }

Also tried using onCompleted callback

function getQuery(jid) {
        return {
            with: jid + '@domain.com',
            max: 5,
            before: '',
            onMessage: function (message) {
                  // my code
            },
            onComplete: function (response) {
                // my code
                connect.mam.query(Strophe.getBareJidFromJid(connect.jid), getQuery(nextJID));
            }
        };
    }

This two ways to trying to do the same thing results as duplicates message from the ejabberd server.

I am using Ejabberd Server and Strophejs on the client

@LTroya LTroya changed the title Getting duplicates messages from mam queru Getting duplicates messages from mam query Oct 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant