ably / ably-asset-tracking-swift

iOS client SDKs for the Ably Asset Tracking service.
Apache License 2.0
9 stars 6 forks source link

Publisher Worker Queue: Enter Presence #560

Open AndyTWF opened 1 year ago

AndyTWF commented 1 year ago

Implement the following workers from AAT Android:

The EnterPresenceWorker does nothing if the trackable is being or has been removed. It asynchronously waits for the ably channel to become attached, and then performs a presence enter operation. If waiting for the ably channel to attach results in failure, then FailTrackable work should be posted.

If presence.enter fails for a non-fatal reason, then retry after 15s. A non-fatal error is defined as any error that ably does not define as fatal (these are status codes 400 -> 499) or the fatal error "Enter presence on suspended channel" which is code 91001.

If presence.enter fails for a fatal reason, then FailTrackable work should be posted.

On presence.enter succeeding, EnterPresenceSuccess work should be posted.

An unexpected async error results in the EnterPresence work being requeued.

EnterPresenceSuccess work marks the trackable as having entered presence, re-resolves resolutions and asks the publisher to update trackable states. It does nothing if the trackable has been removed.

This change also requires an update to ably.connect()

This work is dependent on:

sync-by-unito[bot] commented 1 year ago

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3373