Using the example apps

Asset Tracking SDK repositories provide example apps for subscribing and publishing. You can test out the sample apps using the emulator provided with the developer tools for your platform.

The JavaScript example app only supports the Subscribing SDK. To use it, you must first run one of the publishing example apps to generate location data.

  1. Clone the Ably Asset Tracking SDK JavaScript GitHub repo.
  2. In the root directory of the project, install the SDK dependencies:
npm install
Copied!
  1. Then, build the SDK:
yarn build
Copied!
  1. Change into the examples/subscribing-example-app directory and install the example app’s dependencies:
npm install
Copied!
  1. Create a .env file in the root of the example app and configure it with your Ably API key:
ABLY_API_KEY=your-api-key <br>
Copied!
  1. Open your browser and visit http://localhost:5000:

Select map provider

  1. Select your preferred map provider (Google Maps or Mapbox) and enter your provider’s API key when prompted.
  1. Enter the ID of the asset you want to track:

Select trackable ID

  1. The example app receives updates from the publisher and shows the current location of the asset on the map:

Example app running