-
Notifications
You must be signed in to change notification settings - Fork 52
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
Reason for calling puppet.logout() in puppet.stop()? #184
Comments
The reason for calling puppet.logout() in puppet.stop() is that, the Wechaty program need to maintain the state of the Chatbot session status of whether it is logged in or not. When the Wechaty has been stopped, the puppet system can not garantee the login state will not be changed before next wechaty start, which means that if the Wechaty do not emit the logout event to the program, the program will be highly possible in an incorrect state. That's the reason we decided to emit the In the current design, when the Wechaty start, it will either emit the login event if the bot has the logged in status, or it will emit scan event if the bot account need to be scanned to logged in. The above design will make sure the Chatbot program can maintain a correct log in status of the bot state. I hope it can answer your question, please feel free to let me know if you have more questions. |
OK. So if my understanding is right, the puppet should not override the logout method of puppet? Where should we put the actual puppet logout implementation? |
Your understanding is not correct. A puppet provider implementation can override the logout method as long as it calls the
I hope the above comment also answer this question. |
So
|
Where do you want to our this code block into? Please provide more information to help me understand your design. |
OK. As you know we are trying to merge v0.41 puppet-whatsapp to main. When upgrading wechaty version to 1.x, we found that
|
Thanks for the detailed description. I think your two points are very valuable and should be considered. I'll think about it and update back to you soon. |
After some time of thinking about this situation, I think we should stop calling Changing by this, the problems 1 & 2 that you have described will be solved, and the Please feel free to let me know what you think, and we can create a PR to solve those problems after we have the agreement. |
puppet/src/mixins/login-mixin.ts
Lines 46 to 51 in b5c101c
We noticed that in
login-mixin
, thestop()
method callslogout()
. Could you explain the reason for this behavior?As far as I understand, if we stop a puppet, when we restart it, the session should remain and we don't need to login again. So there is no need to call
logout()
instop()
.The text was updated successfully, but these errors were encountered: