Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

34
Views
How to check if I've read all messages of a particular user in Mesibo - Javascript?

Is there a way to get the number of total messages of a particular read session using the Javascript SDK? We're syncing and reading the messages but the read method always returns true so we are not able to check wether we reached the end of our messages list.

This is a code snippet we're using:

async syncApp(user: string, readCount: number) {
    const on_read = (count: any) => {
        let msgs = mReadSession.getMessages();
    };

    let mReadSession = await this.mesibo.getInstance().readDbSession(user, 0, null, on_read)

// `res` is always true
    let res = await mReadSession.read(readCount);


    if (res < readCount) {
        mReadSession.sync(readCount - res, on_read)
    }

    return mReadSession;
}

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs