Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect event not triggered, when logging out #3016

Open
1 task done
Gauravism2017 opened this issue May 8, 2024 · 0 comments · May be fixed by #2816
Open
1 task done

Disconnect event not triggered, when logging out #3016

Gauravism2017 opened this issue May 8, 2024 · 0 comments · May be fixed by #2816
Labels
bug Something isn't working v2.3000.xx The issue specifically relates to WWeb v2.3000.xx

Comments

@Gauravism2017
Copy link

Gauravism2017 commented May 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

So when I have my wwjs running for long, I have seen that if it gets logget out automatically but the'disconnected' is not triggered.
I tried logging out from my phone also, It still doesnt trigger the disconnected event.

Expected behavior

I am supposed to see the disconnected logs, i.e. console.error("Client was logged out", reason); when disconnected.

Steps to Reproduce the Bug or Issue

Starting the client. And waiting for long enough for it to get disconnected or, forcing log out from the device.

Relevant Code

  this._client = new Client({
    puppeteer: {
      headless: true,
      executablePath: process.env.CHROME_BIN || "",
      args: [
        "--no-sandbox",
        "--disable-setuid-sandbox",
        "--unhandled-rejections=strict",
      ],
    },
    authStrategy: new LocalAuth(),
    qrMaxRetries: 10,
    webVersionCache: {
      type: "remote",
      remotePath: `https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/${appConfig.WAWEB_VERSION}.html`,
    },
  });

  this._client.on("change_state", async (state) => {
    this._sessionStatus = state;
    if (state === "CONNECTED") {
      console.info("Client is connected!");
      this._session = "successChat";
      this._sessionStatus = "successChat";
    }
  });
  this._client.on("ready", () => {
    console.log("Client is ready!");
    this._session = "successChat";
    this._sessionStatus = "successChat";
  });
  this._client.on("disconnected", (reason) => {
    console.error("Client was logged out", reason);
    this.destroyClientInstance();
  });
  const resp = await this._client.initialize();

Browser Type

Google Chrome

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Amazon ami 2
phone: Samsung S22 plus
whatsapp-web.js version: latest master from github with PR(#2816)
Node.js version: 18.12.1

Thanks in advance, LMK if I am missing something.

Additional context

No response

@Gauravism2017 Gauravism2017 added the bug Something isn't working label May 8, 2024
@Gauravism2017 Gauravism2017 changed the title Disconneect event not triggered, when logging out Disconnect event not triggered, when logging out May 8, 2024
@alechkos alechkos closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
@alechkos alechkos added the v2.3000.xx The issue specifically relates to WWeb v2.3000.xx label May 15, 2024
@alechkos alechkos reopened this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2.3000.xx The issue specifically relates to WWeb v2.3000.xx
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants