0

The Documentation provides examples for android and IOS but not for JS. We also looked at the demo projects, but they are in angular. how do we do it in plain JS

I wrote this by imitating the Android example and Angular example

   api.readDbSession(null, '96042', null, function on_message(m) {
        console.log('m is ', m);
        console.log('m.read is ', m.read(100))
    });

But the above results in m is null

1 Answers1

1

Have you checked code on GitHub

var session = api.readDbSession(null, '96042', null, function on_message(m) {
        console.log('m is ', session.messages);
        console.log('m is ', session.getMessages());
    });
    session.read(100);
mesibo
  • 3,970
  • 6
  • 25
  • 43
  • Thanks a lot. It works. Just some additions- session.getMessages() is not a function and also I found messages in session.v.Oa in an unordered way, which can be sorted easily using the timestamp available – Raghavendra Kaushik Jun 03 '20 at 19:38
  • Glad it worked. getMessages() is part of the mesibo beta API (with conferencing). – mesibo Jun 04 '20 at 03:26
  • 1
    Note that this call does not necessarily gives you all past messages in the group. It basically reads the local storage (IndexedDB) for messages, so if the user clears that for some reason, then you won't get those messages again. Mesibo keeps track of what messages got delivered to which clients, and only delivers them once, then the js sdk simply stores it locally. They'll also only receive messages after the time they joined as members. Could be worth clarifying this in their docs. – ZeeCoder Sep 24 '20 at 15:40
  • @ZeeCoder that's exactly the same thing that I encountered when reading their docs as it is not very clear at first. Something that is maybe worth mentioning is that you can host mesibo on your own server and then you can download all messages each time with sync() methods. – contrl Feb 08 '21 at 15:26
  • @contri, it is mentioned here https://mesibo.com/documentation/tutorials/get-started/synchronization/ Where do you think it should have been better mentioned? I can certainly pass feedback to improve documentation. – mesibo Feb 08 '21 at 16:21