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

[BUG] Message sent more than once #24

Open
rwrz opened this issue Feb 7, 2020 · 2 comments
Open

[BUG] Message sent more than once #24

rwrz opened this issue Feb 7, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@rwrz
Copy link

rwrz commented Feb 7, 2020

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

  • Client send messages like this:
	// client sending message - ONCE
	c.Conn.Write(neffos.Message{
		Namespace: "default",
		Room:      "A_ROOM",
		Event:     "AN_EVENT",
		Body:      anyBytesArr,
		SetBinary: true,
	})
  • Server send messages like this:
	// server sending message - TWICE, since it arrives 2 times instead of one
	c.Conn.Server().Broadcast(c, neffos.Message{
		Namespace: "default",
		Room:      "A_ROOM",
		Event:     "AN_EVENT",
		Body:      anyBytesArr,
		SetBinary: true,
	})

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):

  • OS: [Linux, Android, GoMobile]
  • Version [Ubuntu 18.04.3 LTS, Android any, Go 1.13.4]

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

@rwrz rwrz added the bug Something isn't working label Feb 7, 2020
@kataras
Copy link
Owner

kataras commented Feb 7, 2020

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
Copy link
Author

rwrz commented Feb 7, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants