messenger-javascript icon indicating copy to clipboard operation
messenger-javascript copied to clipboard

How to set message status "MESIBO_MSGSTATUS_READ"

Open RomikMakavana opened this issue 4 years ago • 1 comments

Hello Mesibo,

When user receive message message status is changed from MESIBO_MSGSTATUS_SENT to MESIBO_MSGSTATUS_DELIVERED, but when user see the message, message status must change to MESIBO_MSGSTATUS_READ.

I just wanna know, how to set message status MESIBO_MSGSTATUS_READ from frontend https://github.com/mesibo/messenger-javascript

Thank you,

RomikMakavana avatar Mar 09 '21 07:03 RomikMakavana

I also had a similar issue. But, I figured it out.

Once the destination receives the message, they need to load messages for that user and see it in the UI. Then, read() is called https://github.com/mesibo/messenger-javascript/blob/cb3d5f47c254f2776a1315f954c49de833ab44f8/scripts/controller.js#L1022

After that, on sender end, message status will change to MESIBO_MSGSTATUS_READ. It will then show blue tick(marked as read) for that message.

For example,

var messageSession = api.readDbSession('testuser', 0, null,
    function on_read(count) {
	console.log("Read "+ count + " number of messages");
        var messages = messageSession.getMessages();
});
messageSession.enableReadReceipt(true);
messageSession.read(100);

https://mesibo.com/documentation/tutorials/get-started/reading-messages/#javascript-example

heisenberg-hash avatar Mar 10 '21 09:03 heisenberg-hash