3.1.0-rc.4 • Published 2 years ago

@radicalbit/helicon-sdk v3.1.0-rc.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Helicon SDK

Helicon sdk is a javascript library that allows web clients to interact with the Helicon streams api server.

Build

The library is written in typescript, and staging versions can be built with yarn dev or npm run dev command.

Productions builds can be run with yarn build or npm run build.

Compiled files will be deployed in the lib/ folder at project's root.

Usage

Usage of the library is pretty straightforward:

import Helicon from 'helicon-sdk'

const { HeliconWriteClient } = Helicon;
const host = "<host-url>";
const clientId = "<client-id>";
const tenant = "<tenant-name>";
const port = "<host-port>"; // optional, default as 443
const protocol = 'https'; // optional, default as 'https'

// Create a new Helicon SDK istance
const heliconWriteClient = new HeliconWriteClient(host, clientId, tenant, protocol, port, { trace: true });

// add some payload...
const record = {
  "name": "record1",
  "temperature": "29"
};

// and send it to the stream 🚀
heliconWriteClient.write('<streamName>', record).then(
	() => console.log("record published!"),
	(errorMessage) => console.error(errorMessage)
);

How to run the Example

A complete example of the usage of this library can be found in the example/ directory.

To run it, follow those steps:

  1. run yarn install and then yarn build in the root directory of this repository

  2. run yarn install and then yarn start in the example directory