{"id":20770693,"url":"https://github.com/ably/ably-asset-tracking-js","last_synced_at":"2025-04-30T14:02:10.277Z","repository":{"id":37167621,"uuid":"318295050","full_name":"ably/ably-asset-tracking-js","owner":"ably","description":"JavaScript client SDKs for the Ably Asset Tracking service.","archived":false,"fork":false,"pushed_at":"2023-07-19T00:42:00.000Z","size":1244,"stargazers_count":10,"open_issues_count":23,"forks_count":8,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-30T16:46:34.572Z","etag":null,"topics":["asset-tracking","javascript","js","realtime","sdk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ably.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-03T19:15:35.000Z","updated_at":"2024-06-25T04:16:14.000Z","dependencies_parsed_at":"2024-11-17T12:11:28.392Z","dependency_job_id":null,"html_url":"https://github.com/ably/ably-asset-tracking-js","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably%2Fably-asset-tracking-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably%2Fably-asset-tracking-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably%2Fably-asset-tracking-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably%2Fably-asset-tracking-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ably","download_url":"https://codeload.github.com/ably/ably-asset-tracking-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251716506,"owners_count":21632137,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asset-tracking","javascript","js","realtime","sdk"],"created_at":"2024-11-17T12:11:24.539Z","updated_at":"2025-04-30T14:02:10.092Z","avatar_url":"https://github.com/ably.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ably Asset Tracking SDK for JavaScript\n\n![.github/workflows/check.yml](https://github.com/ably/ably-asset-tracking-js/workflows/.github/workflows/check.yml/badge.svg)\n\n## Overview\n\nAbly Asset Tracking SDKs provide an easy way to track multiple assets with realtime location updates powered by [Ably](https://ably.com/) realtime network and Mapbox [Navigation SDK](https://docs.mapbox.com/android/navigation/overview/) with location enhancement.\n\n**Status:** this is a preview version of the SDK. That means that it contains a subset of the final SDK functionality, and the APIs are subject to change. The latest release of this SDK is available in the [Released section](https://github.com/ably/ably-asset-tracking-js/releases) of this repository.\n\nAbly Asset Tracking is:\n\n- **easy to integrate** - comprising two complementary SDKs with easy to use APIs, available for multiple platforms:\n  - Asset Publishing SDK, for embedding in apps running on the courier's device\n  - Asset Subscribing SDK, for embedding in apps runnong on the customer's observing device\n- **extensible** - as Ably is used as the underlying transport, you have direct access to your data and can use Ably integrations for a wide range of applications in addition to direct realtime subscriptions - examples include:\n  - passing to a 3rd party system\n  - persistence for later retrieval\n- **built for purpose** - the APIs and underlying functionality are designed specifically to meet the requirements of a range of common asset tracking use-cases\n\nThis repository contains the Asset Subscribing SDK for Web.\n\n### Documentation\n\nVisit the [Ably Asset Tracking](https://ably.com/documentation/asset-tracking) documentation for a complete API reference and code examples.\n\n###  Useful Resources\n\n- [Introducing Ably Asset Tracking - public beta now available](https://ably.com/blog/ably-asset-tracking-beta)\n- [Accurate Delivery Tracking with Navigation SDK + Ably Realtime Network](https://www.mapbox.com/blog/accurate-delivery-tracking)\n\n## Installation\n\nTo use Ably Asset Tracking in your app, install it as a dependency:\n```bash\n# If you are using NPM:\nnpm install @ably/asset-tracking\n\n# If you are using Yarn:\nyarn add @ably/asset-tracking\n```\n\n## Usage\n\n### Subscribing to location updates\n\n```ts\nimport { Subscriber } from '@ably/asset-tracking';\n\n// Client options passed to the underling ably-js instance.\n// You must provide some way for the client to authenticate with Ably.\n// In this example we're using basic authentication which means we must also provide a clientId.\n// See: https://ably.com/docs/core-features/authentication\nconst ablyOptions = {\n  key: ABLY_API_KEY,\n  clientId: CLIENT_ID,\n};\n\n// Create a Subscriber instance.\nconst subscriber = new Subscriber({\n  ablyOptions,\n});\n\n// Get an asset.\nconst asset = subscriber.get('my_tracking_id');\n\n// Define a callback to be notified when a location update is recieved.\nasset.addLocationListener((locationUpdate) =\u003e {\n  console.log(`Location update recieved. Coordinates: ${locationUpdate.location.geometry.coordinates}`);\n});\n\n// Start tracking the asset. This will attach to the Ably realtime channel and enter presence.\nawait asset.start();\n\n// Stop tracking the asset, at some point later on when you no longer need to receive location updates.\nawait asset.stop();\n```\n\n### Subscribing to driver status\n\n```ts\n// Register a callback to be notified when the asset online status is updated.\nasset.addStatusListener((isOnline) =\u003e {\n  console.log(`Status update: Publisher is now ${isOnline ? 'online' : 'offline'}`);\n});\n```\n\n### Requesting publisher resolution\n```ts\nimport { Accuracy } from '@ably/asset-tracking';\n\n// You can request a specific resolution to be considered by the publisher when you create an asset instance...\nconst resolution = {\n  accuracy: Accuracy.High,\n  desiredInterval: 1000,\n  minimumDisplacement: 1,\n};\n\nconst asset = subscriber.get('my_tracking_id', resolution);\n\n// ...And you can send a request to change the resolution when the asset is already started\nawait asset.sendChangeRequest({\n  accuracy: Accuracy.Low,\n  desiredInterval: 3000,\n  minimumDisplacement: 5,\n});\n```\n\n## Example App\n\nThis repository also contains an example app that showcases how the Ably Asset Tracking SDK can be used:\n\n- the [Asset Subscribing example app](examples/subscribing-example-app/)\n\n## Development\n\nsee [Contributing](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably%2Fably-asset-tracking-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fably%2Fably-asset-tracking-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably%2Fably-asset-tracking-js/lists"}