-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
sendMessage and receiveMessage refactoring? #66
Comments
Hi @viniciuscb I think it make sense to add
Would be good to understand the reason behind it, i. e. why the connection was closed. Is it a bug in a library or it depends on external factors, such "user closed app"/"distance to receiver side became too big and because of that the signal was lost"? |
Hi Kirill. The problem with sendMessage is happening due to external factors. For instance, when the app crashes/is closed in one device, and I didn't receive yet (in the other device) the information that the connection changed in react native level (through listeners/subscribe methods). |
Got it @viniciuscb 👍 P. S. I'm going to create |
I see now that the AsyncTask class became deprecated in API 30. So the receiveMessage will need to have a refactoring anyway. From: https://developer.android.com/reference/android/os/AsyncTask
Besides that, @kirillzyusko and @seba9999 , maybe we can pass an optional parameter to receiveMessage to receive also the metadata (currently only the origin IP address). This way we can maintain backward compatibility. |
@viniciuscb I think if you rewrite and migrate away from AsynTask, then you may not worry about backward compatibility :) In my opinion it's useful to know sender address - of course it will be breaking change, but it will be easy to migrate. Moreover I already have some deprecated methods in API and I would like to remove them and publish new 4.0.0 version :) |
* ISSUE kirillzyusko#66 * also referenced in ISSUE kirillzyusko#32 Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
I've proposed a PR ( #80 ) that does not break backward compatibility. |
* ISSUE kirillzyusko#66 * also referenced in ISSUE kirillzyusko#32 Signed-off-by: Vinicius Cubas Brand <viniciuscb@gmail.com>
I am having another problem now, regarding the sendMessage method. Sometimes the connection is closed and I could not have this information before sending another message. This kills the app. Here is the problem, because groupOwnerAddress is null and I cannot call getHostAddress() on null.
Besides that, I think there should be some way to stop receiving messages. If I call receiveMessage() and (unexpectedly) don't receive any message, a port will stay open waiting for messages. This is a real issue when I call it in a screen, go out and enter this screen again.
Maybe adding a stopReceivingMessage() method or replacing for two methods, startReceivingMessages() and stopReceivingMessages()
The text was updated successfully, but these errors were encountered: