SDK Integration

This document provides steps for integrating your Node.js app or web browser with Hackle via the Hackle SDK for Andriod platforms. SDK Integration is a must in order to use the functions of a Hackle SDK.

Step 1: Add Dependencies

Think of this step as importing our SDK into your codebase. To use our Hackle services add the following dependency code and import our SDK.

npm install --save @hackler/javascript-sdk

Step 2: Initialize the SDK

Once you have imported the dependencies, in order to start using the Hackle SDK you must initialize the SDK. During this step, we get the information needed for SDK integration from the Hackle Server and store it in the SDK

HackleClient is a class that provides methods for using SDK functions.

Instantiation

const Hackle = require("@hackler/javascript-sdk");

// Enter the SDK Key in the YOUR_SERVER_SDK_KEY.
const hackleClient = Hackle.createInstance("YOUR_SERVER_SDK_KEY");

Instantiate HackleClient by passing the SDK key.
HackleClient periodically synchronizes with the hackle server as a background task to constantly obtain the necessary information.

Waiting for Sync

hackleClient.onReady(() => {
  // SDK ready to use
  http.createServer((req, res) => {
    
  }).listen(3000)
});

🚧

Data may be lost if there are user requests before the SDK is ready

Termination

process.on('SIGINT', function() {
  // kill signal
  hackleClient.close();
});

Did this page help you?