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

Function onAnyMessage #2814

Open
valentinolopezbruno opened this issue Oct 4, 2024 · 2 comments
Open

Function onAnyMessage #2814

valentinolopezbruno opened this issue Oct 4, 2024 · 2 comments
Labels
enhancement New feature or request needs triage Needs avaliation

Comments

@valentinolopezbruno
Copy link

Hi everyone, I recently tested the latest version (5.2.0) and when I use the onAnyMessage function, it happens that if the sender or receiver of messages has more than one Whatsapp session (two, three or four), the outgoing/incoming messages will be multiplied by the number of active sessions on the respective phone number.

I want to know if this affected everyone or just me, I would appreciate your opinions.

Maybe I can try to edit the onAnyMessage function to fix this. I think the problem may be occurring in src/lib/wapi/listeners/. But I am not 100% sure about this.

@valentinolopezbruno valentinolopezbruno added enhancement New feature or request needs triage Needs avaliation labels Oct 4, 2024
@ghayman
Copy link
Contributor

ghayman commented Oct 4, 2024

Thanks @valentinolopezbruno - yes I have been seeing this! I could not figure out why it was happening and I've been filtering duplicate messages in my application code.

If you want to have a go at a fix that would be great 😀

@valentinolopezbruno
Copy link
Author

In onAnyMessage function, I was looking at the "logs" of incoming messages and there are no fields that validate a user's session so it forces us to filter duplicate messages by ID. I think the easiest solution is to create an array to store the incoming message IDs and filter to correct duplicates. Then after X amount of time reset the array to free up memory.
What do you think about this @ghayman?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage Needs avaliation
Projects
None yet
Development

No branches or pull requests

2 participants