Duplicate messages from openfire server when receiving archived messages - XEP-0136

I am using the below code to retrieve archived messages from openfire server using Strophe.js and under Server-> Archiving-> Archive settings both one-to-one and group chat archive are enabled.

connection.archive.listCollections(contactId, rsm, function (collections, responseRsm) {
        for(var j = 0; j < collections.length; j++) {
            collections[j].retrieveMessages(rsmMsg, function (messages, responseRsm) {
                for(var i=0; i < messages.length; i++) {
                    console.log(messages[i]);
                }
            });
        }
    });

      

By providing contactId as a JId list, it returns both messages from one-to-one and group chats, and by providing contactId as the JID of the room, it only restarts the room messages, but the messages are duplicated.

Does anyone know how to fix these problems.

+3


source to share





All Articles