uruburu

0.0.19 • Public • Published

uruburu

UI Widgets for real time data

Based on Web components concept and Polymer implementation, this microlibrary provides several components for automation applications. These are widgets that allow you to watch or update real time data.

Provided example is based on Mosca/MQTT in order to push data to the browser. When installing through Node, you get available a Node library that's implements the publish/subscriber part. Then, doing something like:

var uruburu = require('uruburu');

var server = new uruburu.Server({
	port: 31013,
	baseDir: '../'
});

is starting an Express Web Server and Mosca broker, pushing index.jade (from baseDir/views folder) to the browser when connecting to the corresponding location (in this case, <your_ip>:31013). This is 'animating' in some way the data display, since, starting from then, bindings are processed. this means that updating one variable on an object through an user action, updates commonly shared dictionary through MQTT and, then, any graphical object bound to that variable.

Bindings are obtained thanks to attribute specific syntax, which looks like value="{{inputVariable}}" when graphical object is updated by the variable state and like value="@{{outputVariable}}" when variable is updated by the object state.

Library can also be used as Javascript one, without Polymer. In that case, bindings need to be managed by your own.

Tests have been done using Chrome. Touch screens are not currently managed in a proprer way, but library works on Android KitKat devices as well.

Screen capture

Install

npm install uruburu

or clone this repository to your disk, go to the uruburu folder and do:

npm install

You need npm/nodejs to be installed.

Prerequisits

Because Mosca depends on ZMQ, you need to install first the dev version of ZMQ lib:

sudo apt-get install libzmq-dev

ZMQ is not used in our examples, currently.

Run examples

To run server part:

node server.js

To run client part (simple data generation):

node client.js

Usage

See /views/index.jade file.

Which dependencies ? Why ?

One of the worst issues with node, is precisely its bigger advantage: infinite number of available libraries. Everybody can understand that using third party dependencies is avoiding to reinvent the wheel. The piece of code that you write, needs to be as simple and small as possible. Sometimes, there is even no need to write anything: just integrate other's great work is enough. This is about engineering, and not programming.
Any way, it would be good if each project were explaining why it's using each one of its dependencies. At least in a few words. So:

  • Mosca: provides MQTT protocol within a node js broker, as well as through web sockets to the browser client.Indeed, our goal was initially not only to provide a simple graphic library for data acquisition and control, but also a simple mechanism to update all this stuff. Publisher/subscriber is the one that suits better and, then, MQTT seems to be one of the best choices.
  • mqtt.js: mqtt client side, mqtt implementation for Mosca server.
  • express.js and related middlewares (body-parser, serve-favicon): provide a way to create a web server with some sugar embedded and with only few lines of code. For embedded targets with small code foot print necessary, this could be replaced by stuff like node-static, for example.
  • jade: because I don't like HTML and I prefer Jade syntax. Of course, these can be removed very simply and quickly.
  • winston: for fun of logging. Can be removed in 5 minutes.
  • my-ip: get the IP of the machine in a more secured way. No need to hard code the IP and, then, more flexible.

That's only on node js side. Browser side, we use is d3js (simply the best data driven library) and Polymer (only for web components).

And that's all folks...

Package Sidebar

Install

npm i uruburu

Weekly Downloads

1

Version

0.0.19

License

GPLv3

Last publish

Collaborators

  • vandrito