Rhymen / go-whatsapp

WhatsApp Web API
MIT License
2.07k stars 492 forks source link

fix/workaround for #410 #482

Closed SchulteMK closed 3 years ago

SchulteMK commented 3 years ago

Hey @beshoo & @normen, I found the lines that throw the issue. I do not really remember why we implemented this check. So it could have some unwanted side effects (I have not noticed any). Now I am skipping the function instead of throwing an error if the payload is empty.

Can you please try it out and tell me if you encounter issues.

Br, Marcel

normen commented 3 years ago

Yep, indeed works fine now without workaround. No error message when sending.

However I also don't seem to receive my own message via the handler. My app simulates that by creating a message itself, I should be getting two messages if that was intended. I can live fine with that though if thats not the case.

Cheers for fixing this! (and for "teaching" a go noob about the replace command in go.mod by making me import a forked lib 😉)

normen commented 3 years ago

Okay, now I'm getting "Abnormal Closure" errors after a while.. looking for more info.

Am 17.11.2020 11:28 schrieb Marcel Kocks:

Hey @beshoo & @normen, I found the lines that throw the issue. I do not really remember why we implemented this check. So it could have some unwanted side effects (I have not noticed any). Now I am skipping the function instead of throwing an error if the payload is empty.

Can you please try it out and tell me if you encounter issues.

Br, Marcel You can view, comment on, or merge this pull request online at:

https://github.com/Rhymen/go-whatsapp/pull/482

-- Commit Summary --

  • fix/workaround for #410

-- File Changes --

M go.sum (1) M read.go (6)

-- Patch Links --

https://github.com/Rhymen/go-whatsapp/pull/482.patch https://github.com/Rhymen/go-whatsapp/pull/482.diff

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/Rhymen/go-whatsapp/pull/482

SchulteMK commented 3 years ago

Nice to hear that the fix is working :) I am not sure if it is supposed to dispatch send messages. There is no need to do this because the message is already at the sender. The WhatsApp web client or this package sends the message to the whatsapp server. The server acknowledges that it received the message, but there is no need to send the message back. Only incoming messages are dispatched via the handlers. If you want to treat your messages the same as incoming messages you could call your Handler after sending the message.

SchulteMK commented 3 years ago

Okay, now I'm getting "Abnormal Closure" errors after a while. looking for more info.

Abnormal close should not be connected to this issue. I could be that your internet connection cuts out and the ws-connection is terminated. But I am not sure.

normen commented 3 years ago

Abnormal close should not be connected to this issue. I could be that your internet connection cuts out and the ws-connection is terminated. But I am not sure.

Yeah seems so, the connection is stable since I sent that message now. And what you described to get my own message is basically exactly what I'm doing now.

Thanks again!