A dynamically re-routable software toolkit for choreographing interactive spaces. Visit http://www.spacebrew.cc to learn more about spacebrew. On our site we feature a bunch of example apps and tutorials to help you get started. You'll also find a blog where we feature spacebrew projects and events.
@version: 0.4.0
@date: April 10, 2014
@contributors: LAB at Rockwell Group, Quin Kennedy, Brett Renfer, Josh Walton, James Tichenor, Julio Terra
Getting Started
npm install
node node_server_forever.js
node_server_forever.js
vs node_server.js
The first of these two files runs node using the forever-monitor node utility. This utility relaunches the spacebrew server if it crashes and it saves logs of the standard output from the spacebrew server to log files in the data/logs directory.
server=
in the query string points to the appropriate host. Customize the name=
element in the query string to change your apps name. server=
in the query string points to the appropriate host. Spacebrew Server Options
Here is an overview of the command line options that the spacebrew server accepts:
--port (-p): set the port of the spacebrew server (default 9000)
--help (-h): print help text (which is what you are reading here)
--close (-c): force close clients that don't respond to pings
--ping: enable pinging of clients to track who is potentially disconnected (default)
--noping: opposite of --ping
--timeout (-t): minimum number of ms to wait for response pong before force closing (implies --close, default 10000 [10 seconds])
--persist: saves route configurations that are set via any admin interface
--nopersist: opposite of --persist
--log (-l): sets logging to info level
--loglevel: set logging to info, debug, warn, error
--pinginterval: the number of ms between pings (implies --ping, default 1000 [1 second])
--secure: launch the server with https/wss support. See certificate details in the secure/ directory.
Here are a few examples of how to launch the app using command line options:
node node_forever_server.js -p 9011 -t 1000 --pinginterval 1000
node node_server.js --nopersist --loglevel warn
Other Services
The HTTP Link (http_link.js
) is a Node.js app which acts essentially as an HTTP <-> Websocket bridge for Spacebrew. Only GET
requests are supported currently, so all commands are read from the query string. Responses are provided as JSON.
The HTTP Link allows you to use HTTP-only devices, such as the Electric Imp, within the Spacebrew environment.
config
query string key which contains the same json structure as would be sent over Websockets
http://localhost:9092/?config={"config":{"name":"test","publish":{"messages":[{"name":"output","type":"string"},{"name":"out","type":"string"}]},"subscribe":{"messages":[{"name":"input","type":"string"}]}}}
clientID
that you will use in the future to refer your client.publish
query string key which contains an array of messages you wish to publishhttp://localhost:9092/?clientID=0&publish=[{"message":{"clientName":"test","name":"output","type":"string","value":"hello!"}},{"message":{"clientName":"test","name":"output","type":"string","value":"good bye."}}]
poll=true
in the query string. This will return an array of all messages that have been received by the HTTP Link for your client since the last poll:http://localhost:9092/?clientID=0&poll=true
bufferSize
along with your subscriber specificationshttp://localhost:9092/?clientID=0&config={"config":{"name":"test","publish":{"messages":[{"name":"output","type":"string"},{"name":"out","type":"string"}]},"subscribe":{"messages":[{"name":"input","type":"string","bufferSize":3}]}}}
timeout
in secondshttp://localhost:9092/?clientID=0&poll=true&timeout=3600
The Persistent Admin (node_persistent_admin.js
) is a command line Node.js app which makes sure certain specified publishers and subscribers always stay routed to one-another.
After starting the Persistent Admin (node node_persistent_admin.js
in the command line/terminal) you can type help
to get an overview of the various commands available. Basically you can:
ls
to get a list of currently-protected routesadd myClient,pubOne,theirClient,subscriberUno
to connect the pubOne
publisher associated with client myClient
to the subscriberUno
subscriber associated with client theirClient
save
to save to diskload
to load from disk (it will automatically load when starting up)remove 0
to remove the zero'th route from protection (when you list the routes via ls
, the indices listed before each route are what should be used for the remove command)exit
to quit the Persistent Adminadd
command can also be used with regular expressions such as add myClient,.*,theirClient,.*
to connect all publishers from myClient
with all compatible subscribers in theirClient
=============
The MIT License (MIT) Copyright © 2012 LAB at Rockwell Group, http://www.rockwellgroup.com/lab
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.