kataras / neffos

A modern, fast and scalable websocket framework with elegant API written in Go
http://bit.ly/neffos-wiki
MIT License
574 stars 49 forks source link

[BUG] Message sent more than once #24

Open rwrz opened 4 years ago

rwrz commented 4 years ago

Describe the bug Sometimes the message sent arrives more than once on the server side. I can't reproduce the problem, it is happening with some of my clients, currently between an Android emulator and an Android device, on same network. Do I need to create some kind of MSG ID, and control messages that arrives more than once? And is that really possible? Currently, I'm using gobwas Dialers.

To Reproduce

Expected behavior Client send a message once, it arrives just once on server.

Logs Server logs: 2020/02/07 10:00:34 [e4e6f308-680d-4a36-ae06-e90d5c44c623][Room: A_ROOM][Event: AN_EVENT] 2020/02/07 10:00:34 [e4e6f308-680d-4a36-ae06-e90d5c44c623][Room: A_ROOM][Event: AN_EVENT]

Desktop (please complete the following information):

Additional context I'm using GoMobile to compile the client version and use it on an Android app (yay! works on iOS and Android!)

kataras commented 4 years ago

Hello @rwrz,

Thanks for the report. I will find time to investigate it because currently I have no idea why it sends it twice. Could you please post the method you used to compile the client version on Android with GoMobile? (it could be added on wiki pages as well, you can fork).

Thanks, Gerasimos Maropoulos

rwrz commented 4 years ago

@kataras I'm just executing it, nothing different:

gomobile bind -target=android .

The "gomobile" trick is to create an interface with everything you want to expose to your app and this interface has a lot of limitations on its methods signatures. So, don't worry about how to compile it to "gomobile", it will work, just export a simple version of what you need.

About the twice problem, I tried to find something in the library code but seems ok to me. Maybe some "witchcraft" hidden somewhere!

Do you know if WebSockets, in general, is "at least once" kind of delivery? Maybe that's the problem.