This is a node.js client library and API wrapper. Currently, the functionality is limited, but we support these protocols:
- MQTT
- 0
- Via the command-line:
npm install m2mIO
- In your application:
require 'm2mIO'
You need to supply credentials in the constructor:
m2m = new m2mIO(':username',':password')
Params:
- username
- password
username: E-mail address, where the suffix provided will constitute your domain, e.g. supplying a username of frank@2lemetry.com
would make my domain com.2lemetry
.
password: This must be a minimum of 6 characters.
m2m.signup ':username', ':password'
Protocols supported:
- MQTT
- ZMQ
- Creating a client.
m2m.mqtt.connect()
- Subscribing.
You can subscribe on all the traffic in your domain:
- topics
topics An array of namespaces.
m2m.mqtt.subscribe [':domain/#']
Or, you can subsribe on more detailed topics:
m2m.mqtt.subscribe [':domain/:stuff/#',':domain/:stuff/:thing/#']
- Publishing data.
@trace
function doesn't work. StackOveflow