You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the following workers on the Subscriber:
SubscribeForPresenceMessages
Disconnect
ProcessInitialPresenceMessages
Disconnect
Disconnect is passed a callback function () -> Void (for details of this function, see later). It asynchronously calls ably.disconnect() for the trackable and then calls said function/
SubscribeForPresenceMessages
SubscribeForPresenceMessages is called as part of the connection establishment process, and is thus provided with a user callback that is used to feed the result back to the user. All of its work is in the doAsyncWork block.
It begins by getting the current/initial presence messages from ably channel, if this fails then Disconnect work is posted with a custom callback function. This function simply calls the user-provided function with the Result (ie the failure reasons) returned by subscribing for presence messages.
It then calls ably.subscribeForPresence(). If this fails, then a custom callback function similar to the one above is passed to posted Disconnect work. The listener for subscribing to presence should be to post UpdatePublisherPresence work with the presence data.
If all is successful ProcessInitialPresenceMessages work is posted with the initial presence messages.
An unexpected async error shall post Disconnect work.
ProcessInitialPresenceMessages
Calls a method on SubscriberProperties with the initial presence messages. These are iterated through and processed very similarly to how performPresenceUpdated currently does it.
It then posts SubscribeToChannel work, passing through the user callback function.
Implement the following workers on the Subscriber:
Disconnect
Disconnect
is passed a callback function() -> Void
(for details of this function, see later). It asynchronously callsably.disconnect()
for the trackable and then calls said function/SubscribeForPresenceMessages
SubscribeForPresenceMessages is called as part of the connection establishment process, and is thus provided with a user callback that is used to feed the result back to the user. All of its work is in the doAsyncWork block.
It begins by getting the current/initial presence messages from ably channel, if this fails then
Disconnect
work is posted with a custom callback function. This function simply calls the user-provided function with theResult
(ie the failure reasons) returned by subscribing for presence messages.It then calls
ably.subscribeForPresence()
. If this fails, then a custom callback function similar to the one above is passed to postedDisconnect
work. Thelistener
for subscribing to presence should be to postUpdatePublisherPresence
work with the presence data.If all is successful
ProcessInitialPresenceMessages
work is posted with the initial presence messages.An unexpected async error shall post
Disconnect
work.ProcessInitialPresenceMessages
Calls a method on SubscriberProperties with the initial presence messages. These are iterated through and processed very similarly to how
performPresenceUpdated
currently does it.It then posts
SubscribeToChannel
work, passing through the user callback function.This work is dependent on:
The text was updated successfully, but these errors were encountered: