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

Create Asset class separate from Subscriber #108

Closed
owenpearson opened this issue Oct 17, 2022 · 1 comment
Closed

Create Asset class separate from Subscriber #108

owenpearson opened this issue Oct 17, 2022 · 1 comment
Assignees

Comments

@owenpearson
Copy link
Member

owenpearson commented Oct 17, 2022

This would be a more sensible API interface and allow us to implement tracking multiple assets on one connection without a further breaking change.

The usage after this change would look like:

const subscriber = new Subscriber(ablyOptions); // basically just a thin wrapper around Ably.Realtime

const asset = subscriber.get('my-trackable-id'); // analogous to Ably.Realtime.Channels.get

asset.onLocationUpdate(location => {
  // handle location update
});

asset.onStatusUpdate(location => {
  // handle status update
});

await asset.start(); // analogous to RealtimeChannel.attach

await subscriber.sendChangeRequest({
  accuracy: Accuracy.Low,
  desiredInterval: 3000,
  minimumDisplacement: 5,
});
@sync-by-unito
Copy link

sync-by-unito bot commented Oct 17, 2022

➤ Automation for Jira commented:

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

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