The following examples use methods that are related to the Echolo IoT Service using Topics for communication.

Initiate the Library

First, we must require the NPM and append our API credentials to it. Here we are using the custom SDK from Echolo; you can install it with: npm install echolo

let Echolo = require('echolo')({ appId: 'appId', secret: 'secret', apiKey: 'apiKey' })

<aside> ❌ Having trouble with this step? - You may not have API credentials or understand what ones are needed to authenticate. Please see Authentication or Getting Started with the REST API

</aside>

Start the IoT Client

In order to start the IoT Client, you will have needed to create a Hub. On creation of the hub you will get the hubId and key you will need both of the items now.

{ "hubId": "myHubId", "key": "xxxx-xxxx-xxxx-xxxxx-xxxxxx-xxxxxxx" }

Now, lets open the Client with our Hub credentials.

let iot = Echolo.IoT({ "hubId": "myHubId", "key": "xxxx-xxxx-xxxx-xxxxx-xxxxxx-xxxxxxx" })

Listen for events