Skip to content

Latest commit

 

History

History

node

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

node.js

This is a node.js client library and API wrapper. Currently, the functionality is limited, but we support these protocols:

  1. MQTT
  2. 0

Setup

  1. Via the command-line:
npm install m2mIO
  1. In your application:
require 'm2mIO'

Usage

You need to supply credentials in the constructor:

m2m = new m2mIO(':username',':password')

Creating an Account

Params:

  1. username
  2. 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'

Pub/Sub clients

Protocols supported:

  1. MQTT
  2. ZMQ

MQTT

  1. Creating a client.
m2m.mqtt.connect()
  1. Subscribing.

You can subscribe on all the traffic in your domain:

  1. 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/#']

  1. Publishing data.

ZMQ

Dev Notes

  1. @trace function doesn't work. StackOveflow