cylon-robot-disco

1.0.0 • Public • Published

Cylon Robot Discovery

NPM   Build Status   release notes

Cylon Robot Discovery

This package discovers other robots in a local network running RobotDisco.

Once discovered, it attaches the remote robot as a proxy robot into the Cylon.robots in this process. This lets you easily interact with all robots in the disco.

To invoke a command on a remote robot, just invoke their command directly. It will return a promise:

var Jane = Cylon.robots.Jane;
Jane.getMood()
  .then(function(mood) {
    Cylon.logger("Jane's mood is: " + mood);
  });

To listen for events on a remote robot, just start listening. Robot Disco takes care of connecting with and forwarding events to you:

var Jane = Cylon.robots.Jane;
Jane.on('mood_change', function(mood) {
  Cylon.logger("Jane's mood has changed to: " + mood);
});

var Florist = Cylon.robots.Florist;
Florist.sendRoseTo('Jane');

When running the Cylon API, all robots in the network are represented in your process.

This allows API clients such as the Robeaux UI to interact with all robots by connecting with any robot running Robot Disco.

For more information about Cylon, check out the repo at https://github.com/hybridgroup/cylon

Getting Started

Install the module with: npm install cylon-robot-disco

Getting Discovered

To join the club, just add robot-disco to your connections:

 
Cylon.robot({
  connections: {
    ...
    disco: {adaptor: 'robot-disco' }
  },
  ...
}).start();

License

Copyright (c) 2015 Loren West and other contributors. See LICENSE for more details

Dependents (0)

Package Sidebar

Install

npm i cylon-robot-disco

Weekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • lorenwest