open-wa/wa-automate-nodejs

onAnyMessage losing PTT messages sent from HOST DEVICE #1809

dudagervasio posted onGitHub

<!-- READ THIS FIRST: - Make sure you are running the latest version of @open-wa/wa-automate before reporting an issue. - Provide as many details as possible. Paste logs, configuration samples and code into the backticks. DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed without comment. -->

Describe the bug A clear and concise description of what the bug is.

Hook "onAnyMessage" is losing some PTT messages sent from HOST DEVICE

Steps to Reproduce Steps to reproduce the behavior:

  1. Made a fresh install of latest version of @open-wa/wa-automate
  2. Client ready
  3. Got the HOST DEVICE (phone) in hands
  4. Send about 20 to 30 PTT messages for testing
  5. Log received events in console, with a counter
  6. Not all sent ptt messages generates a log

create() code This is the code you use to create the client. e.g

const wa = require('@open-wa/wa-automate');

wa.create({ 
    headless: false,
    logConsole: true,
}).then(client => start(client));

let counter = 0;

function start(client) {

  client.onAnyMessage(async message => {

    if(message.type === 'ptt' && message.fromMe){

        counter++;

        console.log(`PTT from ME n. ${counter}`);

    }

  });

}

Expected behavior A clear and concise description of what you expected to happen.

I expected that ALL ptt messages were captured

DEBUG INFO This is the info printed to the console when you start your app. It should look like this

Debug Info {
  WA_VERSION: 2.2123.7,
  PAGE_UA: WhatsApp/2.2108.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36,
  WA_AUTOMATE_VERSION: 4.5.1,
  BROWSER_VERSION: Chrome/92.0.4512.0,

}

Screenshots

1) TEST ONE Sent 20 messages, lost 2 (10%)

Chrome Instance (headless: false) OK - All 20 ptt messages image

Console Logs only 18 received events image

2) TEST TWO Sent 30 ptt messages, lost 2 (6,7%)

image


In another test last week, as i mentioned at discord, i lost 3 of 10 messages. I also have done some tests with text messages and i had no problem.

Host (please complete the following information): OS: Windows 10, NODE: 14.17.0, NPM: 7.17.0

Additional context Add any other context about the problem here.

Sorry about my poor english :)


@dudagervasio thank you for all the details i will look into this and get back to you with a solution

posted by smashah over 3 years ago

possibly related to #1781

posted by smashah over 3 years ago

Thanks @smashah! In this case, it does not stop listening, as #1781 does, it just lost some messages but continues listening...

posted by dudagervasio over 3 years ago

@dudagervasio Thanks for filling out the template in a way that let me reproduce the issue consistently. I have issued a new patch and tested it with 40+ consecutive voice notes. Should be working now.

thanks

posted by smashah over 3 years ago

I made one test with 40 voice messages without any lose! And it looks like the event is captured faster, i did not measure, just by looking the screen and sending messages ;)

Sorry my delay to test and so much thanks for the quick solution!!!

posted by dudagervasio over 3 years ago

Fund this Issue

$0.00
Funded

Pull requests