Skip to main content
Version: Next

Quick Start

Prerequisites πŸ“‹β€‹

Before you begin, ensure you meet the following requirements for using the SkyPath Web SDK:

  • Access to SkyPath NPM package @yamasee/skypath-sdk-web
  • Node.js and NPM installed on your machine
  • SkyPath API Key

Installation πŸ“¦β€‹

To install the SkyPath Web SDK, use your preferred package manager:

npm install @yamasee/skypath-sdk-web

Alternatively, add the dependency into your package.json file:

package.json
{
"dependencies": {
"@yamasee/skypath-sdk-web": "^0.3.14"
}
}
tip

If you encounter any access issues, refer to our troubleshooting guide.

Importing the SDK​

To use the SDK in your project, import it as follows:

import createSkyPathSDK from "@yamasee/skypath-sdk-web";

Initialization πŸ› οΈβ€‹

Use createSkyPathSDK to initializing the SDK. It authenticates and configures the SDK with your specific settings. The function returns a promise, resolving to an object containing factory functions for the features. It should probably used on your app page load.

const sdk = await createSkyPathSDK({
apiBaseUrl: "https://api.skypath.io", // use https://satging-api.skypath.io for staging environment.

// Authentication parameters
apiKey: "XXXX-XXXX-XXXX-XXXX", // Your SkyPath API key
userId: "user123", // The current user ID
companyName: "AirlineInc", // Your current company name
});
warning

The above authentication method - apiKey - is for development purposes only.

When going to production, use Signed JWT method. For more details, see SDK configuration documentation.

Usage πŸš€β€‹

Once the SDK is initialized, you can use the returned object to interact with the features. For example, let’s use the Observations feature to get live turbulence observations.

  1. First, initialize the observations flow:
const observationsFlow = sdk.createObservationsFlow();
  1. Next, subscribe to the onData event to receive real-time data updates:
observationsFlow.onData((data) => {
// Your code here, for example, update the map layer with the new data
});
  1. To start the flow and begin receiving data, use the start method:
observationsFlow.start();

This will start polling the API for new data, and the onData callback will be called whenever new data is available. This will be called, for example, when enabling the map layer.

  1. You can update the configuration at any time using updateConfig method.

For example, if you want to set/change the polygon area for which you want to receive data on map viewport change, you need to update the flow configuration using the updateConfig method and pass to it the new polygon and aircraft category for which you want to receive data.

// Define a new polygon area
const polygon = [
[ -85.644, 30.748 ],
[ -85.644, 23.381 ],
[ -75.192, 23.381 ],
[ -75.192, 30.748 ],
[ -85.644, 30.748 ]
];

// Specify the aircraft category (C10-C110)
const aircraftCategory = "C60";

// Pass the new polygon to the flow
observationsFlow.updateConfig({ polygon, aircraftCategory });
info

For full list of config options, see the specific feature page.

  1. To pause the flow and stop data updates, use the stop method. This will be called, for example, when hiding the map layer.
observationsFlow.stop();
info

The stop method pauses the flow without terminating it. You can resume the flow anytime by calling start again.

  1. When you're done with the flow, make sure to clean up by calling terminate. This should be called when the feature is no longer needed, for example, when terminating the map screen.
observationsFlow.terminate();

✨ Congratulations!

You’ve successfully integrated the SkyPath Web SDK into your project and initialized the first feature.

warning

Before going live, there is a QA step where the implementation should be mutually reviewed with SkyPath.