-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix: Client.logout
#2661
base: main
Are you sure you want to change the base?
fix: Client.logout
#2661
Conversation
While loging out the session in WWeb, the method also removes the session from all linked devices leaving no 'tails'
Thanks for all! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cant to logout after destroy or close the page
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected in both cases:
- Session list item is removed after calling: await Client.logout()
- "Disconnected" event is fired after closing the session via phone.
why do I need to wait for one minute, I've tried to disconnect under one minute and I get similar error like this : |
Who told you you have to wait 1 minute? |
nobody told me, but based on my experience when I disconnect under one minute I get the error but when I disconnect in one minute or more, there is no error |
How exactly did you test the pr? Until you provide complete information these are just words. |
I scan the phone, and I tried to logout after the phone authenticated and suddenly I get the error but when I scan the phone and waiting for one minute and tried to logout, there is no error at all |
Please provide the code so I could test also |
|
Work for me install independent "puppeteer": "^22.6.4". |
No, the session won't be deleted on every browser crash, but only when you purposly call |
can confirm. Since applying this PR the "hanging" sessions issue was resolved. |
Important
breaking changeFix or feature that would cause existing functionality to change
Table of Contents
- Description
- Related Issues
- I Want to Test this PR
- I Got an Error While Testing This PR ❌
- How Has the PR Been Tested (latest test on 06.12.2023)
- Types of Changes
Description
The
Client.logout
method has executed the WA logout function and straight after that closed the browser with the deletion of the session folder.This resulted in the issue that the current session on the user's phone did not have sufficient time to complete and remained hanging in the list of sessions.
Additionally, the
Client
'sdisconnected
event was not being fired as expected.The PR fixes that issue by subscribing to the Puppeteer
disconnected
event withing theClient.logout
method.Now when
logout
is called, the session on the linked device is terminated first.This triggers the
Client
'sdisconnected
event, which then closes a browser and fires the Puppeteerdisconnected
event ultimately removing the session folder.❗ Breaking Change:
If a current session is terminated from the user's phone, the session folder will be removed, as it is supposed to be
Related Issues
The PR closes #2360, closes #2354, closes #2110, closes #2303, closes #2581, closes #2746, closes #3072
To test this PR by yourself you can run one of the following commands:
If you encounter any errors while testing this PR, please provide in a comment:
console.log(await client.getWWebVersion());
Important
You have to reapply the PR each time it is changed (new commits were pushed since your last application)
How Has The PR Been Tested (latest test on 06.12.2023)
First case:
LocalAuth
authstrategyClient
'sdisconnected
event since the linked session on the device was terminated:Second case:
LocalAuth
authstrategy'Log out'
button on the phone)disconnected
event will be fired since the linked session on the device was terminated:Tested On:
Types of accounts:
Environment:
Types of Changes
Checklist