mist-wrapper
v0.0.4
Published
A class of convenience functions for easy access [ControlThing's](https://www.controlthings.fi) Mist/Wish IoT libraries.
Downloads
4
Readme
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:
Node.js v6. Note that v6.x is required. You can use nvm to run multiple Node versions on the same computer.
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);
});