Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

agile-sdk-test-version

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agile-sdk-test-version

test version of the javascript wrapper for agile-iot sdk

  • 1.4.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Agile SDK

The official JavaScript Agile IoT SDK.

js-semistandard-style Build Status

Role

The intention of this module is to provide developers a nice API to integrate their JavaScript applications with Agile IoT Gateway.

Installation

Install the Agile SDK by running:

$ npm install --save agile-sdk

Documentation

The module exports a single factory function that takes an object including your Agile API hostname as the api property. Additionally, it can receive the idm url and a token.

It's available in node.js and the browser.

var agile = require('agile-sdk')({
  api: 'http://agile.local:8080',
  idm: 'http://agile.local:3000',
  token: "LQCL7C14y84Ayqedjmbm1LuIes1TsSyn5Cv"
})

For convenience it's shipped with a browser bundle too with agileSDK expose as a global constant eg.

<script src="node_modules/agile-sdk/dist/bundle.js"></script>
<script>
var agile = agileSDK({
  api: 'http://agile.local:8080',
  idm: 'http://agile.local:3000',
  token: "LQCL7C14y84Ayqedjmbm1LuIes1TsSyn5Cv"
});

agile.protocolManager.discovery.start()
.then(function() {
  console.log('started!')
})
.catch(function(err) {
  console.log(err)
});
</script>

Here a example of reading data from a device:

import agileSDK from 'agile-sdk';

const agile = agileSDK({
  api: 'http://agile.local:8080',
  idm: 'http://agile.local:3000',
  token: "LQCL7C14y84Ayqedjmbm1LuIes1TsSyn5Cv"
});
const deviceId = 'bleB0B448BE5084';
const componentID = 'Temperature';

agile.device.subscribe(deviceId, componentID).then(stream => {
  stream.onerror = () => {
    console.log('Connection Error');
  };

  stream.onopen = () => {
    console.log('Connected');
  };

  stream.onclose = () => {
    console.log('Closed');
  };

  stream.onmessage = (e) => {
    if (typeof e.data === 'string') {
        console.log("Received: '" + e.data + "'");
    }
  };
}).catch(err => {
  console.log(err);
});

Read full documentation.

Change Log

The change log is automatically managed by versionist. View full change log.

Support

If you're having any problem, please raise an issue on GitHub and the team will be happy to help.

Tests

npm run test

Keywords

FAQs

Package last updated on 15 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc