Git Product home page Git Product logo

spacebrew's Introduction

Spacebrew Server

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

1. Install Dependencies

  • Download and install Node.js
  • Clone the repo from github
  • Install the dependencies using node packaged modules
    • npm install

2. Run the Server

  • Open terminal and navigate to the base directory of the spacebrew server
  • Run the server by using 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.

3. Connect Client Apps

  • Open the spacebrew_button example - make sure that the server= in the query string points to the appropriate host. Customize the name= element in the query string to change your apps name.
  • Open the spacebrew admin interface in another browser window - again, make sure that the server= in the query string points to the appropriate host.
  • Start connecting apps and routing data.

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

HTTP Link

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.

  1. Register a client by sending a 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"}]}}}
    • this is the human-readable version, don't forget to URL encode the data first
  • The HTTP Link will respond with a clientID that you will use in the future to refer your client.
  • You can send messages into the Spacebrew environment by sending a publish query string key which contains an array of messages you wish to publish
    • http://localhost:9092/?clientID=0&publish=[{"message":{"clientName":"test","name":"output","type":"string","value":"hello!"}},{"message":{"clientName":"test","name":"output","type":"string","value":"good bye."}}]
    • in this case we are sending 2 messages
  • You can retrieve sent messages by including 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
  • By default, only one message is queued per subscriber. If you wish to queue more, you can send a bufferSize along with your subscriber specifications
    • http://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}]}}}
    • this example also shows how you can send a config update
  • By default the HTTP Link will remove your client after 5 minutes if there is no queries associated with it. You can change this at any time by specifying a custom timeout in seconds
    • http://localhost:9092/?clientID=0&poll=true&timeout=3600
    • this example polls for input and also sets a 1-hour timeout

Command Line Persistent Admin

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 routes
  • add 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 disk
  • load 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 Admin
  • the add 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

=============

LICENSE

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.

spacebrew's People

Contributors

adenine avatar dayvson avatar gschomburg avatar hapticdata avatar julioterra avatar mnmly avatar nbartzokas avatar quinkennedy avatar robotconscience avatar snorpey avatar trippingly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spacebrew's Issues

Chat Roulette

A server that periodically re-routes all clients of a specific type (with a specific publisher/subscriber config) into groups of complete graphs.

No Success! Message

I think the server should report Success! when it starts up.

A stretch goal would be to only report Success! if there are no errors or warnings.

Rollover for description

Show the description of the Client on rollover
-or maybe add a Questionmark icon to toggle showing the info.

Route Suggester

a simple admin-based app that suggests some random route to create every time you load the page.

Route Persister should always display persistent routes, and allow editing

Right now persistent routes are hidden in the GUI if one or both ends are disconnected. So there is no way to break inactive routes in the GUI. It would be nice to show them even if they are not currently active, and allow them to be removed even if they are not active (especially then).

Basically this would mirror the functionality of the CLI

minor issue with re-adding broken route

when A client disconnects and re-connects, Sometimes you cannot add the route the first time you try, but it works fine the second time.

using redesigned admin.

connect two chat clients to SB server.
use the admin to connect them together.
refresh the page of one of the clients.
try to connect the two clients the same way as in step 2.
notice that they change color, but the connection doesn't appear. Also notice that messages attempted to send along that route do not actually send
disconnect the route using the admin then try to re-connect
it works now.

implement --pinginterval

There is a flag defined for setting the ping interval on the server, it should be implemented.
instigated by issue #37

Change title to say 'untitled' if no name is provided - number them

(Untitled) 1
(Untitled) 2
etc. This is interesting, should be done on the server I suppose, maybe a better solution would be, any duplicate name, have the server append an index to it. Then clients without names can send (Untitled) and they would automatically be indexed by the Server.

Otherwise, right now, the Admin would need to see if the 'name' looks like a web address, and if so, then display "(Untitled) x" etc...

Connection between Publisher & Subscriber lost when IP changes

Hello

I have my own Spacebrew server installed in Heroku and I have tried the button example and it works fine (changing the color background). The problem comes when my laptop's external IP, changes, For example from 10.179.151.165 to 10.231.195.45. Then I can see two version of the same button and the connection between publisher and subscriber is lost (In the same button) so when I press the button, the background color doesn't change.

There are something I have missed?

Thanks

Cannot receive any messages

Hi,

I've installed your server and tried to receive data on multiple platforms. But I still cannot get any data back. Even on your cloud server. When I use the admin panel I get:

6utils.js:33 Uncaught TypeError: Cannot read property 'Safetify' of undefined

when an app is started.

When I use your Openframeworks addon, I see the functions, but there's no activity

Receiver should highlight during clicks

Or maybe for now just highlight all route lines coming from an active publisher. A stretch goal is to have the receiver Ack that it received the message and display that Ack in the admin.

Error in --help (--noping)

--noping is mentioned twice in the --help

--ping: enable pinging of clients to track who is potentially disconnected (default)
--noping: opposite of --ping
--persist: enables the live route persister, which saves route configurations
--noping: opposite of --persist

I guess the second one should be --nopersist (?)

Issue with broadcasted messages

In more recent versions of the server, it seems that something is wrong with outbound messages sent from the server. I say recent because the public server works fine, my local version worked as of commit ...69ea90 (~Oct 2013), but new installs on an rPi and AWS, as well as my local server after a pull, don't respond to subscribed messages.

I took a look at the websocket traffic being received by the browser with the Chrome inspector and it looks like message.clientName is now being broadcast when it wasn't before. Perhaps that's the cause? Take a look at these screenshots…the first is from the sandbox and the second is a newer version of the server from git.

(If you're not familiar with the Chrome websocket inspector, green lines are messages sent by the browser and white lines are received from the server).

Hope that helps!

Matt

screen shot 2014-03-19 at 6 44 40 pm
Working, from the sandbox

screen shot 2014-03-18 at 10 14 22 pm
Non-working version from git/master

Windows phone not working

Hi,

I've got spacebrew running on a local server and can connect clients from iPhones, iPads etc but for some reason it fails on windows phone (10):

try {
this.sb = new Spacebrew.Client({server: this.server});
this.sb.name(this.appName);
this.sb.connect();
} catch (e) {
alert(e);
}

I just get TypeError: Invalid calling object

Any ideas?

create way to inform Clients of errors

Perhaps create a new message type from the Server -> Clients and Admins that can tell the Client or Admin that they sent a message that triggered an error.

something like {error:{msg:"wtf, are you trying to ruin this for everyone?"}}

you know, or something helpful.

Missing live_persist_config.json

I'm following README as instructed and when running

node node_server_forever.js

or

node node_server.js

I get a warning:

warn: [loadRoutes] live routes config file does not exist live_persist_config.json

and a message is served to the browser "Not implemented".

Not sure what the problem is here.

migrate to ws module

The chat roulette admin and the persistent route admin should both be migrated to the 'ws' node module so that we don't have to worry about too many dependencies.

Cannot read property 'Safetify' of undefined in utils.js

Hi - I seem to be able to start a server just fine and load up the button and admin interfaces, but the admin interface is blank. I notice an error in the chrome inspector:

Cannot read property 'Safetify' of undefined in utils.js - line 32. See attached screenshots. Have tried running interfaces from spacebrew.github.io as well as from localhost and ip with the same results. Using a version of spacebrew cloned from this repo two days ago.

I also get the issue mentioned here:

#41

no matter how many times I start up the server.

screen shot 2015-05-26 at 9 58 50 am
screen shot 2015-05-26 at 9 58 56 am

Spacebrew.js library not working on Firefox on OSX

The library is able to connect to a spacebrew server, however, the json messages that are sent don't seem to be properly formatted. The apps on the receiving end are not able to appropriately parse the messages.

Is this project still alive?

Last commit is from several months ago and activity has reduced a lot from last year to now.
I ask to know if there are any plans/ideas/roadmap to relaunch this project.
Thanks

add test scripts

This should probably be split into a separate issue for each test script. I don't have experience in test-driven dev, but perhaps some "black-box" testing of each app as a whole would be good. I'm envisioning test scripts for:

  • Spacebrew Server
  • Persistent Admin
  • HTTP Link

add 'X' to destroy a route

As in the comps, an 'X' should appear beside each connected pub/sub that is connected to the selected (clicked) pub/sub

Chaos Monkey

To spew garbage data at the server and try to crash it.

Unable to run spacebrew on openshift nodejs server?!

Hi there,

I've tried to install Spacebrew for an Arduino Yun project on a 'openshift' nodejs server, but get the following error when I go to the url:

Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.2.15 (Red Hat) Server at spacebrew-cuebo.rhcloud.com Port 80

I tried to restart, nut no luck. If I log in to the server and see the dir.log I get the following message:

Error: listen EACCES
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1020:19)
at listen (net.js:1061:10)
at net.js:1143:9
at dns.js:72:18
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:902:3
warn: [Restart] the spacebrew server has been restarted 1584 time
Running Spacebrew, start with argument '--help' to see available configuration arguments.
More info at http://www.spacebrew.cc

Openshift run the following version of node:
Node.js 0.10

I'm not sure what the problem is or how I can fix it?

initialize clients in a grid in plumbing admin

so they don't all end up in the top left corner. At least place them next to each other in a grid as they are created.

Stretch goal 1: put clients with more publishers near the top, and clients with more subscribers near the bottom

Stretch goal 2: cache the placement of clients by name, so if they re-connect they will re-appear in the same location as previously. Possibly check for overlap, so if you already have something where a re-connecting client is supposed to go, they don't end up stacked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.