🚀 Spacebro 💫
In reference to Spacebrew by Rockwell Lab (http://www.rockwellgroup.com/search/LAB)

Spacebro automagically links apps between them. It binds them with events
. You just start a spacebro server somewhere, connect your spacebro clients thanks to mdns/zeroconf/bonjour and listen to them events`.
Prerequisites
Spacebro uses:
- mdns to allow your apps to connect seamlessly.
- socket.io to broadcast events.
Linux
$ sudo apt-get install avahi-daemon avahi-discover libnss-mdns libavahi-compat-libdnssd-dev curl build-essential
Usage
As a CLI tool
Install it globally
$ npm i -g spacebro
$ yarn global add spacebro
And just run the bin
:
$ spacebro
You can configure it via CLI args:
$ spacebro --port 8888
$ spacebro --port 8888 --servicename woowoo
$ spacebro --help
NOTE: Default service name is "spacebro"
and port number is 8888
.
As a module
$ npm i --save spacebro
$ yarn add spacebro
And configure it through a config JSON object:
{
"server": {
"serviceName": "spacebro",
"port": 8888
}
}
serviceName
is the name that Spacebro will use over Zeroconf.port
defines where the spacebro websocket (socket.io) will listen.
NOTE: Default service name is "spacebro"
and port number is 8888
.
This is useful if you want to use the spacebro-client
as is. The spacebro client allows to connect your node application to spacebro server, just by requiring it.
See spacebro-client to learn more.
For openFramework you can also use ofxSpaceBro.
Options
flag | what it does |
---|
-h, --help | output usage information |
-V, --version | output the version number |
-S, --servicename [value] | give the service a name |
-P, --port <n> | give a port to spacebro |
-M, --mute | option to hide informations |
--semiverbose | do not show events datas in logs |
-H, --hidedashboard | Allow to hide dashboard |
-C, --config [value] | give a path to config.json file |
Events
new-member
spacebro broadcasts a new-member
event when a new connection is created, with the connection name as member
property value. Typically, you'd do on the client side:
spacebroClient.on('new-member', (data) => {
console.log(`${data.member} has joined.`)
})
Troubleshooting
ping pong
Do not try to test with 'ping'
and 'pong'
events, those are reserved.
- `ping`. Fired when a ping packet is written out to the server.
- `pong`. Fired when a pong is received from the server.
source
Test
CLI tool
The spacebro ecosystem is ever growing, and it now has a dedicated spacebro-client-CLI that is super useful for quick testing both servers and clients.
Contribute
We use galaxies names for our release name, listed here here. We are currently at Black Eye.
You can check the examples/
folder, as well as the spacebro-client examples for real life examples.
Please follow standard style conventions.