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
15.46k stars 3.68k forks source link

how to check if client is initialized or not? #1942

Closed Rafay02 closed 1 year ago

Rafay02 commented 1 year ago

Is there an existing issue for this?

Describe the bug

How can I determine whether cleint has been initialised? The issue is that when I establish a client and finish the process, it works, but when I shut that endpoint abruptly, then I re-initialized this client, then it enters in loading mode and request time out message appear. and How can I utilise the Status enum described in the WAWebJS class? It is exportable, but I can't seem to locate any usage examples for it.

Expected behavior

If Client has already been initialized, I don't want to initialize it again; else, I initialize it.

Steps to Reproduce the Bug or Issue

  1. create endpoint that initialized a client with specific id
  2. triggered that endpoint and stop before it complete its full process
  3. then again triggered this endpoint with same client id it will goes on loading and never returns

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Windows, ubuntu Phone: Android whatsapp-web.js version: 1.18.4 NodeJS : v16.17.1

Additional context

No response

KJoaquin commented 1 year ago

You will have the example of the message that it gives you in the console

Rafay02 commented 1 year ago

You will have the example of the message that it gives you in the console

actually it didn't give any error, it goes on loading mode

Shvan11 commented 1 year ago

I have the same issue, I believe there should be a simple way to determine whether the client is already initialized.

Rafay02 commented 1 year ago

I have the same issue, I believe there should be a simple way to determine whether the client is already initialized.

I am still looking for the solution if u have made any progress then kindly let me know

shubhamcoreform commented 1 year ago

Have you found any solution? I am also facing this issue.

Rafay02 commented 1 year ago

no solution yet for this issue, closing this issue