0.2.0 • Published 12 months ago

katsana-overwatch v0.2.0

Weekly downloads
-
License
BSD-2-Clause
Repository
-
Last release
12 months ago

Overwatch

A simple request engine to fetch streaming of location update for KATSANA™ beacon.

Installation

You can install the package via NPM or Yarn.

npm install katsana-overwatch

or,

yarn add katsana-overwatch

Importing Overwatch

Once installed, you can easily import the library using the following

const Overwatch = require('katsana-overwatch');

Configuration

By default you can either use SSE or Websocket connection, you can start by configurating the connection using Overwatch.config():

Overwatch.config({
  sse: { url: "https://demo.katsana.com/sse" },
  websocket: { url: "https://demo.katsana.com/websocket", token: "xyz" }
});

Streaming

Once configuration has been made, you can start streaming the data using the following:

class Listener {
  locate(vehicle: any): void {
    // triggered when vehicle is located
  }

  update(status: number): void {
    // trigger when server made a response.
  }

  get vehicle(): any {
    // return the current vehicle
  }

  get vehicles(): Array<any> {
    // return all vehicles
  }
}

var feed = new Overwatch();

feed.driver('sse').make(new Listener()).dispatch(); // you can change the driver to "sse" or "websocket"
1.0.1

12 months ago

0.2.0

12 months ago

1.0.0

1 year ago

0.1.4

4 years ago

0.1.4-beta.0

4 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago