🚀 Spacebro
In reference to Spacebrew by Rockwell Lab (http://www.rockwellgroup.com/search/LAB)
Spacebro automagically links apps between them. It binds them based on events
.
You just define a list of events and make sure your client apps emits and listen to them.
It follow a centralized model where each apps automagically connects thru zeroconf and socket.io to the Spacebro server.
Then each of them register a supplementary list of events.
Prerequisites
Space bro use:
- mdns to allow your app to connect seamlessly
- socket.io to broadcast events
- cli-table to display a list of connected clients
- lodash to easily handle array manipulation
Linux
$ sudo apt-get install avahi-daemon avahi-discover libnss-mdns libavahi-compat-libdnssd-dev curl build-essential
Install Spacebro to use it as a module
$ npm i --save spacebro
You can also install globally if you want to run the bin instead of developping your own app:
$ npm i -g --save spacebro
Configure
Spacebro is awaiting a config file that looks like :
{
"server": {
"port": 8888,
"serviceName": "spacebro"
}
}
The port
define where Spacebro (socket.io) will listen.
The serviceName
is the name that Spacebro will use over Zeroconf.
Usage as a Module
const config = require('../config.json')
var spacebro = require('spacebro')
spacebro.init(config)
Usage as an app
You just run the bin
:
spacebro
or
spacebro --port 8888
or
spacebro --port 8888 --servicename woowoo
By default the service name is spacebro
and the port number is 8888
This is useful if you want to use the spacebro-client
as is. The spacebro client allow to connect your node application to spacebro server, just by requiring it.
See Spacebro Client on github to learn more.
For openFramework you can also use ofxSpaceBro.
Develop
You can test sending events with the dev/send-events.js
script. Run npm run send-events
.
Please follow standard style conventions.