Skip to content

Getting duplicates messages from mam query #122

@LTroya

Description

@LTroya

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions