pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.53k stars 3.46k forks source link

Whatsapp cannot send and receiving message #1665

Closed krismandev closed 7 months ago

krismandev commented 1 year ago

Is there an existing issue for this?

Describe the bug

whatsapp stops receiving messages when state changes to OPENING then CONNECTED.

even though the status is connected, whatsapp still can't send and receive messages until we reconnect.

it always happens when change_state event is raised and the state shows OPENING.

the state changes to OPENING at an unpredictable time.

Expected behavior

The expected behavior is whatsapp will still be able to receive messages even though the state changes to OPENING and CONNECTED again without do reconnect

Steps to Reproduce the Bug or Issue

I'm not able to reproduce the bug.

Relevant Code

No response

Browser Type

Google Chrome

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

Linux whatsapp-web.js 1.17.1 version

Additional context

No response

serbioortega commented 1 year ago
const client = new Client({
      authStrategy: new LocalAuth(),
      puppeteer: {
          args: ['--no-sandbox'],
      }
  });

client.on('ready', async () => {
    client.pupPage.on('error', (event) => {
        client.destroy();
        client.initialize();
    });
});
budirama commented 1 year ago

Can we used this code to detect if whatsapp number banned ? I need read the event if wa number is banned .

PurpShell commented 1 year ago

Is there any more you can provide? The OPENING state is when the page goes to the loading screen, I don't think what is happening is normal behavior within WhatsApp Web

YisusCore commented 1 year ago
const client = new Client({
      authStrategy: new LocalAuth(),
      puppeteer: {
          args: ['--no-sandbox'],
      }
  });

client.on('ready', async () => {
    client.pupPage.on('error', (event) => {
        client.destroy();
        client.initialize();
    });
});

that was a good temporary solution but my instance has more than 5k chats and take more than 4 minutes to complete the initialize