relaycorp / awala-endpoint-android

High-level library for Android apps implementing Awala endpoints
Apache License 2.0
1 stars 1 forks source link

Reconnect to parcel collection endpoint as first-party endpoints are registered or deleted #346

Closed gnarea closed 11 months ago

gnarea commented 11 months ago

If you create a first-party endpoint after calling receiveMessages(), you won't receive messages bound for that first-party endpoint.

sdsantos commented 11 months ago

Calling receiveMessages does not affect parcel collection. We only fetch new parcels when the Gateway app notifies, one-off (CloseUponCompletion), and we fetch with all the first-party endpoints we have. So apparently there is no issue with the SDK. I'll check next the Gateway app, maybe it's not refreshing it's parcel collection when new endpoints are registered.

gnarea commented 11 months ago

we fetch with all the first-party endpoints we have

That's the problem -- The nonce signers isn't actually updated as new first-party endpoints are registered, unless I'm missing something:

https://github.com/relaycorp/awala-endpoint-android/blob/0d39f7fb24701faedfda88df05c4efe09d6d7ece/lib/src/main/java/tech/relaycorp/awaladroid/messaging/ReceiveMessages.kt#L75-L95

sdsantos commented 11 months ago

That runs every time the gateway notifies the app to fetch new parcels. So if the new endpoint received some message, when it is notified for it, the nonce signers will be the new ones.


The Gateway app code also looks good, nothing should require a sync restart when a new endpoint is registered. So next I'll try to reproduce the issue with the Ping app.

gnarea commented 11 months ago

Thanks @sdsantos! If you still can't reproduce it, let's put a pin on this whilst we try again. Maybe we just experienced a different issue or made a mistake.

sdsantos commented 11 months ago

Thanks @sdsantos! If you still can't reproduce it, let's put a pin on this whilst we try again. Maybe we just experienced a different issue or made a mistake.

Tried to reproduce it with the Ping app. I delayed creating the endpoint 5 seconds, but subscribed to receiveMessages immediately. The Pong was still received without a problem. So I suggest dropping this until it can be reproduced again with an app.

gnarea commented 11 months ago

Sounds good! Will reopen this if that's the case.