https://github.com/bobvanderlinden/node-machinetalk
A client-side Node API for remotely controlling/monitoring Machinekit instances through Machinetalk
https://github.com/bobvanderlinden/node-machinetalk
Last synced: about 1 month ago
JSON representation
A client-side Node API for remotely controlling/monitoring Machinekit instances through Machinetalk
- Host: GitHub
- URL: https://github.com/bobvanderlinden/node-machinetalk
- Owner: bobvanderlinden
- License: lgpl-3.0
- Created: 2015-08-29T23:20:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-17T16:41:50.000Z (over 9 years ago)
- Last Synced: 2025-03-22T21:06:15.954Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 2
- Watchers: 3
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-machinetalk
This project is in a very early phase. Its goal is to provide an easy to use API for discovering, monitoring and controlling Machinetalk instances.
[](https://travis-ci.org/bobvanderlinden/node-machinetalk)
[](https://david-dm.org/bobvanderlinden/node-machinetalk)## Installation
```sh
npm install --save machinetalk
```## Usage
```js
var machinetalk = require('machinetalk');// Initiate a machine browser that discovers Machinetalk
// machines on the network with their capabilities (services).
var browser = new machinetalk.MachineTalkBrowser();// Wait for services to be discovered.
browser.on('serviceUp', function(service) {
// We are only interested in the 'status' service.
if (service.name !== 'status') { return; }// Initiate a status client that can retrieve status updates.
var statusclient = new machinetalk.StatusClient(service.dsn);// Wait for status updates for motion and print them.
statusclient.on('motionstatuschanged', function(status) {
console.log('Machine position: ',
status.position.x,
status.position.y,
status.position.z
);
});// Connect to the status service.
// We are only interested in 'motion' updates.
statusclient.connect();
statusclient.subscribe('motion');
});// Start discovering machines.
browser.start();
```## Examples
[See the Examples directory](https://github.com/bobvanderlinden/node-machinetalk/tree/master/examples)