Currently, the main public Publisher interfaces for tracking new Trackables (Publisher.track(), Publisher.add(), also Publisher.remove()) all throw ConnectionException in the event that we're unable to connect to Ably at the instant those functions are called. We discussed this internally and agreed that this isn't the most helpful design. Summary from internal discussion:
Generally, we handle being offline for long periods. Trackables simply move to the Offline state if we're unable to publish updates.
It seems arbitrary that, if connectivity failed 1ms after a call to track(), there'd be no errors for the client to handle - the Trackable moves to the Offline state as designed, but if the call arrives that tiny bit later, we require the client to set up their own background retry loop, effectively duplicating AAT functionality.
Consequently, agreed interpretations of trackable states are:
Online: connected and present;
Offline: not online, but for a non-fatal reason (eg not yet connected, or retriable error attempting to attach or enter);
Failed: the connection or channel are in the failed state, or presence enter failed with a non-retriable error
If any of the operations required to add and track failed for a non-retriable reason, then it's Failed. If all of the operations required are in one of the following states:
Description copied from the Android #871 issue:
Currently, the main public Publisher interfaces for tracking new Trackables (
Publisher.track()
,Publisher.add()
, alsoPublisher.remove()
) all throwConnectionException
in the event that we're unable to connect to Ably at the instant those functions are called. We discussed this internally and agreed that this isn't the most helpful design. Summary from internal discussion:Offline
state if we're unable to publish updates.track()
, there'd be no errors for the client to handle - the Trackable moves to theOffline
state as designed, but if the call arrives that tiny bit later, we require the client to set up their own background retry loop, effectively duplicating AAT functionality.Consequently, agreed interpretations of trackable states are:
Online
: connected and present;Offline
: not online, but for a non-fatal reason (eg not yet connected, or retriable error attempting to attach or enter);Failed
: the connection or channel are in the failed state, or presence enter failed with a non-retriable errorIf any of the operations required to add and track failed for a non-retriable reason, then it's
Failed
. If all of the operations required are in one of the following states:then it's
Offline
.