4.0.0 • Published 8 years ago

meshblu-websocket v4.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

meshblu-websocket

Pure websocket implementation of the Meshblu client

Build Status npm version Gitter

Install

npm install meshblu-websocket

Example

var MeshbluWebsocket = require('meshblu-websocket');
var MeshbluConfig = require('meshblu-config');

var meshbluConfig = new MeshbluConfig().toJSON();
var meshblu = new MeshbluWebsocket(meshbluConfig);

meshblu.connect(function(error){
  if (error) {
    console.error(error.message);
  }

  meshblu.subscribe({uuid: meshbluConfig.uuid});

  meshblu.on('config', function(data){
    console.log('config', data);
  });

  meshblu.updateDangerously({
    uuid: meshbluConfig.uuid,
    token: meshbluConfig.token
  }, {
    '$push': {
      stuff: {
        foo: 'bar'
      }
    }
  });
});