This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including mym2m-client
with all npm
packages installed. Try it out:
'use strict';
var mym2m = require('mym2m-client');
// create a new API client with your device key and unit identifier
var myDevice = new mym2m.API('YOUR-DEVICE-KEY', 'UNIT00001');
// create a snapshot with some sample data
var snapshot = new mym2m.Snapshot();
snapshot.setChannel('temp', 25);
snapshot.setChannel('humid', 40);
// add the snapshot
myDevice.add(snapshot);
// dispatch!
myDevice.dispatch()
.catch(function(result) {
console.log(result);
console.error('Dispatch failed. You can inspect result.response and result.error to debug.');
});
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.