Skip to content
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

Subscriber Worker Queue: Subscribe To Presence #588

Open
AndyTWF opened this issue Feb 22, 2023 · 1 comment
Open

Subscriber Worker Queue: Subscribe To Presence #588

AndyTWF opened this issue Feb 22, 2023 · 1 comment
Milestone

Comments

@AndyTWF
Copy link
Contributor

AndyTWF commented Feb 22, 2023

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.

This work is dependent on:

@sync-by-unito
Copy link

sync-by-unito bot commented Feb 22, 2023

➤ Automation for Jira commented:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant