0.0.4 • Published 5 years ago

mist-wrapper v0.0.4

Weekly downloads
-
License
(MIT OR Apache-2....
Repository
-
Last release
5 years ago

mist-wrapper

A class of convenience functions for easy access ControlThing's Mist/Wish IoT libraries.

The source code in this project is released under Apache 2.0. To actually implement cool solutions you need to license ControlThing's libraries. Head over to their web to learn more about that!

Prerequisites

When running Linux x64 or macOS x64 everything should work swimmingly if you follow the instructions below. Windows isn't supported (yet).

Install:

  1. Node.js v6. Note that v6.x is required. You can use nvm to run multiple Node versions on the same computer.

  2. Wish, the p2p communication layer Mist is using. Download the Wish binaries for Linux/macOS, or build it from the Wish source code. Copy the wish-core binary into the examples root folder.

Installation

$ npm install mist-wrapper --save

Usage

Start Your Engines (the Core)

Assuming you have the Wish binary installed in the root folder and named wish-core:

$ chmod a+x wish-core
$ ./wish-core -a 9094 -p 37300

Hello World

var MistWrapper = require("mist-wrapper");

const init = {
  name: "MyEntity",
  coreIp: "127.0.0.1",
  corePort: 9094
};

var api = new MistWrapper(init.name, init.coreIp, init.corePort);

function main() {
  console.log("Connection to Mist/Wish core successful! Hello World!");
}

api
  .open()
  .then(() => {
    api
      .onReady()
      .then(() => {
        main(api);
      })
      .catch(err => {
        console.error(err);
      });
  })
  .catch(err => {
    console.error(err);
  });
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago