SlideShare a Scribd company logo
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew Basics
Spacebrew Workshop - NYU ITP - Brett Renfer
Obligatory hype video!
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew…
• is a service and toolkit for
choreographing interactive spaces
• makes it easy to connect interactive
things to one another
• was developed to support prototyping-
driven design efforts
Spacebrew at SFPC - Brett Renfer
Spacebrew is supported by a
group of amazing people.
Arduino Day - NYU ITP - Brett Renfer & Julio Terra
Remote Presence Experiments
Havas Madsci Lab
Whispering Stairs,
Shu Yang Lin
Next Round
Gustavo Faria, Bernardo Schorr and Stephanie Burgess
Forget Me Not Remote Flower Watering,
Lucy Matchett, Joselyn McDonald, Nicole Messier
Spacebrew Workshop - NYU ITP - Brett Renfer
“Landing Page”, Mountain View, CA, 2010

with LAB at Rockwell Group
Spacebrew Workshop - NYU ITP - Brett Renfer
JS
Libraries
Spacebrew aims to be
implementation agnostic.

We want to use the right tools
at the right time!
Spacebrew Workshop - NYU ITP - Brett Renfer
Why?
• We’ve used a lot of “glue” languages/
toolkits in the past, but there wasn’t one
that was truly cross-platform/cross-toolkit.

• Wanted to build a toolkit with a low floor
and a high ceiling: easy for speed
prototypes, advanced enough to handle
commercial applications.
Spacebrew Workshop - NYU ITP - Brett Renfer
client
app
client
app
client
app
client
app
Client-Server Model
Each client can feature one or
more publishers and subscribers.
The server can be hosted online
or run on a local network (more
on that later).
Spacebrew Workshop - NYU ITP - Brett Renfer
client
app
client
app
client
app
client
app
Client-Server Model
Clients communicate with the
server via WebSockets. All data
is formatted as JSON
Spacebrew Workshop - NYU ITP - Brett Renfer
Client-Server Model
The server routes all publishers
and subscribers. Routes can be
edited via a switchboard-like
interface
Spacebrew Workshop - NYU ITP - Brett Renfer
Data Types
Three standard types allow for
quick and easy routing.
Custom types are also supported
= true or false
= 0-1023
= “some text”
Spacebrew Workshop - NYU ITP - Brett Renfer
Publishers + Subscribers
Each client announces its
publishers and subscribers to
the server when it launches
client app
Publishers:
...
Subscribers:
...
Spacebrew Workshop - NYU ITP - Brett Renfer
Publishers + Subscribers
This announcement includes the
name and type of each, allowing
for semantic relationships and
automatic routing between
different apps (respectively!)
client app
Publishers
Subscribers
CUSTOM
BOOLEAN
RANGE
RANGE
STRING
Spacebrew Workshop - NYU ITP - Brett Renfer
Publishers + Subscribers
Names of publishers and
subscribers can be anything.



We try to make them make some
sort of sense…
client app
Publishers
Subscribers
“TEXT”
“MOVING”
“COLOR”
“TONE”
“POINT”
Spacebrew Workshop - NYU ITP - Brett Renfer
Messages
Apps send Messages out on a
publisher route. Each Message
contains the name and value.
Messages of a custom type also
include their type.
client app
Name: “MOVING”
Value: FALSE
Spacebrew Workshop - NYU ITP - Brett Renfer
Messages
Apps receive Messages from the
Spacebrew server on a
subscribers route. Each Message
contains the name and value
matching a route in the app.
Messages of a custom type also
include their type.
client app
Name: “TEXT”
Value: “Hey!”
Spacebrew Workshop - NYU ITP - Brett Renfer
Messages, Illustrated
client
app A
client
app B
App with boolean
publisher “MOVING”
Route between
A:”MOVING” and
B:”BG ON”
App with boolean
subscriber “BG ON”
Spacebrew Workshop - NYU ITP - Brett Renfer
Messages, Illustrated
client
app A
Name: “MOVING”
Value: FALSE
Name: “BG ON”
Value: FALSE
client
app B
Spacebrew Workshop - NYU ITP - Brett Renfer
Using Spacebrew
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew Libraries
Each Spacebrew library:
• Connects to a Spacebrew server via WebSockets
• Has an API to declare its publisher(s) and
subscriber(s)
• Receives messages from Spacebrew and dispatches
events accordingly
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew Libraries
Connecting to Spacebrew in each Library
• Create a Spacebrew Object
• Tell your object the IP or hostname of the
Spacebrew server
• Declare any publishers and subscribers
• Connect
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew + Processing
• spacebrewP5 is a Spacebrew-supported library

• install the library from

spacebrewP5/dist/spacebrew to 

~/Documents/Processing/libraries 

(make the folder if it doesn’t exist!)

• restart Processing if it was open

• open the spacebrew_base example to get started!
Spacebrew Workshop - NYU ITP - Brett Renfer
Thinking About Apps
• We try to silo apps whenever possible
• Create specialized apps that are easy to re-use
• Allows for multiple languages for each need
• Quickly and easily move between machines/
networks when necessary
• Allows for easy prototypes in the future!
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew + Javascript
• spacebrew.js is a stand-alone script that can run in
any browser that supports WebSockets

• this includes: Chrome (OS X, Windows, Android,
iOS), Safari (OS X, iOS), Firefox, Opera, IE 10

• open the spacebrew slider example in your text editor

• open http://bit.ly/sbslide on your smartphone

• also try http://bit.ly/sbaccel
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew + Javascript
• spacebrew.js uses query strings to dynamically pass in
the name, server, and description:



http://YOUR_APP.com/index.html?name=NAME&server=SERVER

• The first query string always starts with “?” and the
rest with “&”. They follow the format &NAME=VALUE

• Any app that uses spacebrew.js can do this!
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew + openFrameworks
• ofxSpacebrew connects to Spacebrew via
ofxLibwebsockets

• once you have both installed, you can create
ofxSpacebrew projects via the OF project generator

• let’s look at example_button
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew + Arduino
• Two routes:

• the easy road: use Processing + Serial or Firmata

• the road less travelled: Spacebrew Arduino lib



http://github.com/labatrockwell/spacebrew-arduino-library

• requires Arduino Ethernet shield
• notoriously difficult to debug!
Spacebrew Workshop - NYU ITP - Brett Renfer
Questions?
Spacebrew Workshop - NYU ITP - Brett Renfer
Lunch O’Clock
Spacebrew Workshop - NYU ITP - Brett Renfer
Custom Types
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Custom Types
• Spacebrew supports arbitrary type names 

and data 

(anything that reads as valid JSON will work)
• Similar to built-in types, you can only
route to matching types

• Example: “float” cannot route to “number”
Spacebrew Workshop - NYU ITP - Brett Renfer
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Example: Ultrabook Tree
• Each input station sent a
custom “bloom” object:
• Which image (id)
• Number of laptops
• Radius
• Relative position (x,y)
• Velocity
• Rotation
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Custom Type Demo 1
• Break free of the tyranny of the int: 

let’s send some floats!
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Custom Types: Basics
• Set up Spacebrew pub + sub as usual,

but use any name (e.g. float)
• Add the onCustomMessage function to listen
• When you send, do two things:
1. Make sure you use your custom type!
2. Cast your custom data to a string
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Custom Type Demo 2
• JSON in Processing
• Why JSON?
• It’s a simple way to send arbitrary
objects
• Spacebrew uses it, so all libs have some
sort of JSON library included (if there
isn’t one built in)
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Quick JSON primer
• JSON is a simple way to write out objects
• JSON is made up of name-value pairs
• Names are strings (in quotes!)
• Values can be numbers, strings, booleans,
arrays, null (empty), or objects
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Quick JSON primer
• { = start an object
• } = end an object
• : = between all names and their value
• , = between all name-value pairs



{

“x”:0,

“y”:0

}
Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra
Spacebrew Workshop - NYU ITP - Brett Renfer
Quick JSON primer
{
"name":"cool object",
"position":{
"x":0,
"y":0
},
"candy I like":[
"twizzlers",
"ginger snaps"
]
}
Spacebrew Workshop - NYU ITP - Brett Renfer
You Got Served
Spacebrew Workshop - NYU ITP - Brett Renfer
Running Your Own Server
• Why?

• sandbox.spacebrew.cc is on the slowest AWS tier
• Running over the internet introduces some level
of latency
• Running a local server OR a remote server allows
a level of control: only people you choose can
route/reroute, break your routes, etc
• Allows you to customize the server code if 

you choose!
Spacebrew Workshop - NYU ITP - Brett Renfer
Running Your Own Server
• How?
• Setup! Only needs to be done once

• Download and install nodejs: www.nodejs.org
• Install node dependencies:
• npm install ws
• npm install forever-monitor
Spacebrew Workshop - NYU ITP - Brett Renfer
Running Your Own Server
• How?
• Run! What you’ll do every time:

• In terminal, cd to the spacebrew directory
• Run: node node_server_forever.js
Spacebrew Workshop - NYU ITP - Brett Renfer
Running Your Own Server Online
• How?
• If you want to set up your own remote server, we
recommend this tutorial (by fellow ITPers!):

https://vimeo.com/60001410
Spacebrew Workshop - NYU ITP - Brett Renfer
Persistence
• Another advantage of running your own server is you
can use the persistent admin
• The persistent admin is a separate service that
lets you edit, save, load, and persist routes
• It allows you to specify specific app routings:

coolApp -> coolPub to lameApp -> lameSub
• It also allows for powerful wild card routings:

.* -> coolPub to .* -> lameSub
• This routes any app that publishes “coolPub” to
any other app that subscribes to “lameSub”
Spacebrew Workshop - NYU ITP - Brett Renfer
Persistence
• You can run the persistent admin from the spacebrew
directory:

node node_persistent_admin.js
• From the command line, you can list, add, remove, load,
and save routes:
• list: ls

• add: add client1Name,pub,client2Name,sub
• use .* to create a wildcard

• remove: remove [index]
• you can find an index after add or by listing

• save / load (just that!)
• load is called on start automatically
Spacebrew Workshop - NYU ITP - Brett Renfer
Binary
• A bleeding-edge feature of Spacebrew is sending
binary data

• The sandbox server does not allow you to send
binary data, but your own server does!

• Let’s check out the javascript and openFrameworks
image examples
Spacebrew Workshop - NYU ITP - Brett Renfer
Admin
Spacebrew Workshop - NYU ITP - Brett Renfer
The Admin API
• You don’t just have to use our web interface!
• Javascript, openFrameworks and Cinder (Processing
soon) support the Admin API
• The Admin API subscribes to Spacebrew similar to a
client, firing events each time a client connects/
disconnects or changes its pub/sub map
• It allows you to view, edit, and add any and all
routes in real time!
• This allows for apps like the Admin Randomizer
from the Zip! Zap! Zow! exercise
Spacebrew Workshop - NYU ITP - Brett Renfer
The Admin API
• Try it out: http://bit.ly/sbslider-admin

• Let’s look at the Admin API in Javascript
Spacebrew Workshop - NYU ITP - Brett Renfer
The End
@robotconscience
brett@robotconscience.com
Ad

Recommended

ITP Spacebrew Workshop - Spring 2014
ITP Spacebrew Workshop - Spring 2014
Brett Renfer
 
Spacebrew @ SFPC
Spacebrew @ SFPC
Brett Renfer
 
Plone on Amazon EC2
Plone on Amazon EC2
Jazkarta, Inc.
 
Test
Test
PaulMWatson
 
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
Plone in the Cloud - an on-demand CMS hosted on Amazon EC2
Jazkarta, Inc.
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
Pablo Godel
 
Terraform modules and (some of) best practices
Terraform modules and (some of) best practices
Anton Babenko
 
Expert JavaScript Programming
Expert JavaScript Programming
Yoshiki Shibukawa
 
Steelcon 2015 - 0wning the internet of trash
Steelcon 2015 - 0wning the internet of trash
infodox
 
Building MapAttack
Building MapAttack
Kyle Drake
 
Jruby a Pi and a database
Jruby a Pi and a database
Philipp Fehre
 
Storm distributed processing
Storm distributed processing
ducquoc_vn
 
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet
 
Amazing KDE (K Desktop Environment)
Amazing KDE (K Desktop Environment)
anandvaidya
 
Bittorrent
Bittorrent
sravan3637
 
Docker and Fluentd
Docker and Fluentd
N Masahiro
 
BSides Edinburgh 2017 - TR-06FAIL and other CPE Configuration Disasters
BSides Edinburgh 2017 - TR-06FAIL and other CPE Configuration Disasters
infodox
 
hover.in at CUFP 2009
hover.in at CUFP 2009
Bhasker Kode
 
Generator Tricks for Systems Programmers
Generator Tricks for Systems Programmers
David Beazley (Dabeaz LLC)
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
Yury Bushmelev
 
OpenStack and Ceph: the Winning Pair
OpenStack and Ceph: the Winning Pair
Red_Hat_Storage
 
Os Tucker
Os Tucker
oscon2007
 
Linux Perf Tools
Linux Perf Tools
Raj Pandey
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
ice799
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
Mandi Walls
 
Rustbridge
Rustbridge
kent marete
 
Steamlining your puppet development workflow
Steamlining your puppet development workflow
Tomas Doran
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
dotCloud
 
Spacebrew Server Workshop @ ITP
Spacebrew Server Workshop @ ITP
Julio Terra
 
MFADT Spacebrew: Class 1
MFADT Spacebrew: Class 1
Brett Renfer
 

More Related Content

What's hot (20)

Steelcon 2015 - 0wning the internet of trash
Steelcon 2015 - 0wning the internet of trash
infodox
 
Building MapAttack
Building MapAttack
Kyle Drake
 
Jruby a Pi and a database
Jruby a Pi and a database
Philipp Fehre
 
Storm distributed processing
Storm distributed processing
ducquoc_vn
 
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet
 
Amazing KDE (K Desktop Environment)
Amazing KDE (K Desktop Environment)
anandvaidya
 
Bittorrent
Bittorrent
sravan3637
 
Docker and Fluentd
Docker and Fluentd
N Masahiro
 
BSides Edinburgh 2017 - TR-06FAIL and other CPE Configuration Disasters
BSides Edinburgh 2017 - TR-06FAIL and other CPE Configuration Disasters
infodox
 
hover.in at CUFP 2009
hover.in at CUFP 2009
Bhasker Kode
 
Generator Tricks for Systems Programmers
Generator Tricks for Systems Programmers
David Beazley (Dabeaz LLC)
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
Yury Bushmelev
 
OpenStack and Ceph: the Winning Pair
OpenStack and Ceph: the Winning Pair
Red_Hat_Storage
 
Os Tucker
Os Tucker
oscon2007
 
Linux Perf Tools
Linux Perf Tools
Raj Pandey
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
ice799
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
Mandi Walls
 
Rustbridge
Rustbridge
kent marete
 
Steamlining your puppet development workflow
Steamlining your puppet development workflow
Tomas Doran
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
dotCloud
 
Steelcon 2015 - 0wning the internet of trash
Steelcon 2015 - 0wning the internet of trash
infodox
 
Building MapAttack
Building MapAttack
Kyle Drake
 
Jruby a Pi and a database
Jruby a Pi and a database
Philipp Fehre
 
Storm distributed processing
Storm distributed processing
ducquoc_vn
 
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet
 
Amazing KDE (K Desktop Environment)
Amazing KDE (K Desktop Environment)
anandvaidya
 
Docker and Fluentd
Docker and Fluentd
N Masahiro
 
BSides Edinburgh 2017 - TR-06FAIL and other CPE Configuration Disasters
BSides Edinburgh 2017 - TR-06FAIL and other CPE Configuration Disasters
infodox
 
hover.in at CUFP 2009
hover.in at CUFP 2009
Bhasker Kode
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
Yury Bushmelev
 
OpenStack and Ceph: the Winning Pair
OpenStack and Ceph: the Winning Pair
Red_Hat_Storage
 
Linux Perf Tools
Linux Perf Tools
Raj Pandey
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
ice799
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
Mandi Walls
 
Steamlining your puppet development workflow
Steamlining your puppet development workflow
Tomas Doran
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
dotCloud
 

Similar to Spacebrew: The Overview (20)

Spacebrew Server Workshop @ ITP
Spacebrew Server Workshop @ ITP
Julio Terra
 
MFADT Spacebrew: Class 1
MFADT Spacebrew: Class 1
Brett Renfer
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
endian7000
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Adam Dunkels
 
Quest for a low powered home hub 120522
Quest for a low powered home hub 120522
Paul Tanner
 
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
SenZations Summer School
 
CatDroid talk: thinking different, sharing ideas
CatDroid talk: thinking different, sharing ideas
Loic Ortola
 
Coffee & Pi - Getting Started with Python
Coffee & Pi - Getting Started with Python
Brad ☼ Derstine
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
 
Easy IoT with JavaScript
Easy IoT with JavaScript
Samsung Open Source Group
 
Master-Master Replication and Scaling of an Application Between Each of the I...
Master-Master Replication and Scaling of an Application Between Each of the I...
vsoshnikov
 
Having fun with a solar panel, camera and Apache projects.pdf
Having fun with a solar panel, camera and Apache projects.pdf
Jean-Frederic Clere
 
BLE Localiser (Full) for iOS Dev Scout
BLE Localiser (Full) for iOS Dev Scout
yeokm1
 
Web servers for the Internet of Things
Web servers for the Internet of Things
Alexandru Radovici
 
Using R for the internet of things
Using R for the internet of things
cdhowe
 
IoT4Devs (1)
IoT4Devs (1)
Henri Cavalcante
 
Let’s write open IoText protocol for time-series data in Rust
Let’s write open IoText protocol for time-series data in Rust
Marcin Bielak
 
Internet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! night
Andy Gelme
 
IzoT platform presentation
IzoT platform presentation
Echelon Corporation
 
Fundamental components of the Internet of Things unit 1.pdf
Fundamental components of the Internet of Things unit 1.pdf
govindsingh258478
 
Spacebrew Server Workshop @ ITP
Spacebrew Server Workshop @ ITP
Julio Terra
 
MFADT Spacebrew: Class 1
MFADT Spacebrew: Class 1
Brett Renfer
 
appborg, coffeesurgeon, moof, logging-system
appborg, coffeesurgeon, moof, logging-system
endian7000
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Adam Dunkels
 
Quest for a low powered home hub 120522
Quest for a low powered home hub 120522
Paul Tanner
 
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
Using Java Script and COMPOSE to build cool IoT applications, SenZations 2015
SenZations Summer School
 
CatDroid talk: thinking different, sharing ideas
CatDroid talk: thinking different, sharing ideas
Loic Ortola
 
Coffee & Pi - Getting Started with Python
Coffee & Pi - Getting Started with Python
Brad ☼ Derstine
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
 
Master-Master Replication and Scaling of an Application Between Each of the I...
Master-Master Replication and Scaling of an Application Between Each of the I...
vsoshnikov
 
Having fun with a solar panel, camera and Apache projects.pdf
Having fun with a solar panel, camera and Apache projects.pdf
Jean-Frederic Clere
 
BLE Localiser (Full) for iOS Dev Scout
BLE Localiser (Full) for iOS Dev Scout
yeokm1
 
Web servers for the Internet of Things
Web servers for the Internet of Things
Alexandru Radovici
 
Using R for the internet of things
Using R for the internet of things
cdhowe
 
Let’s write open IoText protocol for time-series data in Rust
Let’s write open IoText protocol for time-series data in Rust
Marcin Bielak
 
Internet Of Things: Hands on: YOW! night
Internet Of Things: Hands on: YOW! night
Andy Gelme
 
Fundamental components of the Internet of Things unit 1.pdf
Fundamental components of the Internet of Things unit 1.pdf
govindsingh258478
 
Ad

Recently uploaded (20)

GOV. Incentives for ED[1][1][1].pptx [Read-Only].pptx
GOV. Incentives for ED[1][1][1].pptx [Read-Only].pptx
kunalArora758765
 
ART & FUNDAMENTALS OF DESIGN CHAPTER -01.pptx
ART & FUNDAMENTALS OF DESIGN CHAPTER -01.pptx
riteshsahdev2
 
Corneal_Edema_MCQs_with_answes click here
Corneal_Edema_MCQs_with_answes click here
priapria0901
 
Marketplaces to Buy and Sell Social Media Accounts.pdf
Marketplaces to Buy and Sell Social Media Accounts.pdf
jamedthomsn
 
Indian_Constitution_Presentation.pptx , images
Indian_Constitution_Presentation.pptx , images
jaglandushyant
 
Quectel M10 AT commands Arduino Microcontroller
Quectel M10 AT commands Arduino Microcontroller
AdamSunusiHaruna1
 
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
NaveedRehman55
 
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
Taqyea
 
Sir Norman Foster Philip Jodidio TASCHEN
Sir Norman Foster Philip Jodidio TASCHEN
FernandoMondragon14
 
Internet Download Manager (IDM) Crack Free Download 2025
Internet Download Manager (IDM) Crack Free Download 2025
Designer
 
最新版美国威斯康星大学普拉特维尔分校毕业证(UWP毕业证书)原版定制
最新版美国威斯康星大学普拉特维尔分校毕业证(UWP毕业证书)原版定制
taqyea
 
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
14ANUSHAVPARCHI
 
Aimee White Visual Thinking, Graphic Design, Livermore
Aimee White Visual Thinking, Graphic Design, Livermore
aimeewhite13
 
Poster Design Principles lesson for Kids
Poster Design Principles lesson for Kids
emiliechingwork
 
The_Geometry_of_Natshshshshshsbsure.pptx
The_Geometry_of_Natshshshshshsbsure.pptx
sambal5
 
strees management for iuyagvdywyyqwdghuvuy.pptx
strees management for iuyagvdywyyqwdghuvuy.pptx
moonahish27
 
Nueva presentación para diapositivas de power point.pdf
Nueva presentación para diapositivas de power point.pdf
SubaruKun1
 
Exploring the Diverse Types of Textual Aids
Exploring the Diverse Types of Textual Aids
jenicahmendoza1
 
week2.pptx program program program problems
week2.pptx program program program problems
doramira833
 
Basic Paterns you can edit to add content
Basic Paterns you can edit to add content
ELAINETUMLOSPERALTA
 
GOV. Incentives for ED[1][1][1].pptx [Read-Only].pptx
GOV. Incentives for ED[1][1][1].pptx [Read-Only].pptx
kunalArora758765
 
ART & FUNDAMENTALS OF DESIGN CHAPTER -01.pptx
ART & FUNDAMENTALS OF DESIGN CHAPTER -01.pptx
riteshsahdev2
 
Corneal_Edema_MCQs_with_answes click here
Corneal_Edema_MCQs_with_answes click here
priapria0901
 
Marketplaces to Buy and Sell Social Media Accounts.pdf
Marketplaces to Buy and Sell Social Media Accounts.pdf
jamedthomsn
 
Indian_Constitution_Presentation.pptx , images
Indian_Constitution_Presentation.pptx , images
jaglandushyant
 
Quectel M10 AT commands Arduino Microcontroller
Quectel M10 AT commands Arduino Microcontroller
AdamSunusiHaruna1
 
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
Chapter 5 - 2,Chapter 5 - 2,Chapter 5 - 2
NaveedRehman55
 
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
最新版美国北密歇根大学毕业证(NMU毕业证书)原版定制
Taqyea
 
Sir Norman Foster Philip Jodidio TASCHEN
Sir Norman Foster Philip Jodidio TASCHEN
FernandoMondragon14
 
Internet Download Manager (IDM) Crack Free Download 2025
Internet Download Manager (IDM) Crack Free Download 2025
Designer
 
最新版美国威斯康星大学普拉特维尔分校毕业证(UWP毕业证书)原版定制
最新版美国威斯康星大学普拉特维尔分校毕业证(UWP毕业证书)原版定制
taqyea
 
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
SUN PATH AND SHADOW ANGLESarchitrcture.pdf
14ANUSHAVPARCHI
 
Aimee White Visual Thinking, Graphic Design, Livermore
Aimee White Visual Thinking, Graphic Design, Livermore
aimeewhite13
 
Poster Design Principles lesson for Kids
Poster Design Principles lesson for Kids
emiliechingwork
 
The_Geometry_of_Natshshshshshsbsure.pptx
The_Geometry_of_Natshshshshshsbsure.pptx
sambal5
 
strees management for iuyagvdywyyqwdghuvuy.pptx
strees management for iuyagvdywyyqwdghuvuy.pptx
moonahish27
 
Nueva presentación para diapositivas de power point.pdf
Nueva presentación para diapositivas de power point.pdf
SubaruKun1
 
Exploring the Diverse Types of Textual Aids
Exploring the Diverse Types of Textual Aids
jenicahmendoza1
 
week2.pptx program program program problems
week2.pptx program program program problems
doramira833
 
Basic Paterns you can edit to add content
Basic Paterns you can edit to add content
ELAINETUMLOSPERALTA
 
Ad

Spacebrew: The Overview

  • 1. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew
  • 2. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew Basics
  • 3. Spacebrew Workshop - NYU ITP - Brett Renfer Obligatory hype video!
  • 4. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew… • is a service and toolkit for choreographing interactive spaces • makes it easy to connect interactive things to one another • was developed to support prototyping- driven design efforts
  • 5. Spacebrew at SFPC - Brett Renfer Spacebrew is supported by a group of amazing people.
  • 6. Arduino Day - NYU ITP - Brett Renfer & Julio Terra Remote Presence Experiments Havas Madsci Lab Whispering Stairs, Shu Yang Lin Next Round Gustavo Faria, Bernardo Schorr and Stephanie Burgess Forget Me Not Remote Flower Watering, Lucy Matchett, Joselyn McDonald, Nicole Messier
  • 7. Spacebrew Workshop - NYU ITP - Brett Renfer “Landing Page”, Mountain View, CA, 2010
 with LAB at Rockwell Group
  • 8. Spacebrew Workshop - NYU ITP - Brett Renfer JS Libraries Spacebrew aims to be implementation agnostic.
 We want to use the right tools at the right time!
  • 9. Spacebrew Workshop - NYU ITP - Brett Renfer Why? • We’ve used a lot of “glue” languages/ toolkits in the past, but there wasn’t one that was truly cross-platform/cross-toolkit.
 • Wanted to build a toolkit with a low floor and a high ceiling: easy for speed prototypes, advanced enough to handle commercial applications.
  • 10. Spacebrew Workshop - NYU ITP - Brett Renfer client app client app client app client app Client-Server Model Each client can feature one or more publishers and subscribers. The server can be hosted online or run on a local network (more on that later).
  • 11. Spacebrew Workshop - NYU ITP - Brett Renfer client app client app client app client app Client-Server Model Clients communicate with the server via WebSockets. All data is formatted as JSON
  • 12. Spacebrew Workshop - NYU ITP - Brett Renfer Client-Server Model The server routes all publishers and subscribers. Routes can be edited via a switchboard-like interface
  • 13. Spacebrew Workshop - NYU ITP - Brett Renfer Data Types Three standard types allow for quick and easy routing. Custom types are also supported = true or false = 0-1023 = “some text”
  • 14. Spacebrew Workshop - NYU ITP - Brett Renfer Publishers + Subscribers Each client announces its publishers and subscribers to the server when it launches client app Publishers: ... Subscribers: ...
  • 15. Spacebrew Workshop - NYU ITP - Brett Renfer Publishers + Subscribers This announcement includes the name and type of each, allowing for semantic relationships and automatic routing between different apps (respectively!) client app Publishers Subscribers CUSTOM BOOLEAN RANGE RANGE STRING
  • 16. Spacebrew Workshop - NYU ITP - Brett Renfer Publishers + Subscribers Names of publishers and subscribers can be anything.
 
 We try to make them make some sort of sense… client app Publishers Subscribers “TEXT” “MOVING” “COLOR” “TONE” “POINT”
  • 17. Spacebrew Workshop - NYU ITP - Brett Renfer Messages Apps send Messages out on a publisher route. Each Message contains the name and value. Messages of a custom type also include their type. client app Name: “MOVING” Value: FALSE
  • 18. Spacebrew Workshop - NYU ITP - Brett Renfer Messages Apps receive Messages from the Spacebrew server on a subscribers route. Each Message contains the name and value matching a route in the app. Messages of a custom type also include their type. client app Name: “TEXT” Value: “Hey!”
  • 19. Spacebrew Workshop - NYU ITP - Brett Renfer Messages, Illustrated client app A client app B App with boolean publisher “MOVING” Route between A:”MOVING” and B:”BG ON” App with boolean subscriber “BG ON”
  • 20. Spacebrew Workshop - NYU ITP - Brett Renfer Messages, Illustrated client app A Name: “MOVING” Value: FALSE Name: “BG ON” Value: FALSE client app B
  • 21. Spacebrew Workshop - NYU ITP - Brett Renfer Using Spacebrew
  • 22. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew Libraries Each Spacebrew library: • Connects to a Spacebrew server via WebSockets • Has an API to declare its publisher(s) and subscriber(s) • Receives messages from Spacebrew and dispatches events accordingly
  • 23. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew Libraries Connecting to Spacebrew in each Library • Create a Spacebrew Object • Tell your object the IP or hostname of the Spacebrew server • Declare any publishers and subscribers • Connect
  • 24. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew + Processing • spacebrewP5 is a Spacebrew-supported library
 • install the library from
 spacebrewP5/dist/spacebrew to 
 ~/Documents/Processing/libraries 
 (make the folder if it doesn’t exist!)
 • restart Processing if it was open
 • open the spacebrew_base example to get started!
  • 25. Spacebrew Workshop - NYU ITP - Brett Renfer Thinking About Apps • We try to silo apps whenever possible • Create specialized apps that are easy to re-use • Allows for multiple languages for each need • Quickly and easily move between machines/ networks when necessary • Allows for easy prototypes in the future!
  • 26. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew + Javascript • spacebrew.js is a stand-alone script that can run in any browser that supports WebSockets
 • this includes: Chrome (OS X, Windows, Android, iOS), Safari (OS X, iOS), Firefox, Opera, IE 10
 • open the spacebrew slider example in your text editor
 • open http://bit.ly/sbslide on your smartphone
 • also try http://bit.ly/sbaccel
  • 27. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew + Javascript • spacebrew.js uses query strings to dynamically pass in the name, server, and description:
 
 http://YOUR_APP.com/index.html?name=NAME&server=SERVER
 • The first query string always starts with “?” and the rest with “&”. They follow the format &NAME=VALUE
 • Any app that uses spacebrew.js can do this!
  • 28. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew + openFrameworks • ofxSpacebrew connects to Spacebrew via ofxLibwebsockets
 • once you have both installed, you can create ofxSpacebrew projects via the OF project generator
 • let’s look at example_button
  • 29. Spacebrew Workshop - NYU ITP - Brett Renfer Spacebrew + Arduino • Two routes:
 • the easy road: use Processing + Serial or Firmata
 • the road less travelled: Spacebrew Arduino lib
 
 http://github.com/labatrockwell/spacebrew-arduino-library
 • requires Arduino Ethernet shield • notoriously difficult to debug!
  • 30. Spacebrew Workshop - NYU ITP - Brett Renfer Questions?
  • 31. Spacebrew Workshop - NYU ITP - Brett Renfer Lunch O’Clock
  • 32. Spacebrew Workshop - NYU ITP - Brett Renfer Custom Types
  • 33. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Custom Types • Spacebrew supports arbitrary type names 
 and data 
 (anything that reads as valid JSON will work) • Similar to built-in types, you can only route to matching types
 • Example: “float” cannot route to “number”
  • 34. Spacebrew Workshop - NYU ITP - Brett Renfer
  • 35. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Example: Ultrabook Tree • Each input station sent a custom “bloom” object: • Which image (id) • Number of laptops • Radius • Relative position (x,y) • Velocity • Rotation
  • 36. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Custom Type Demo 1 • Break free of the tyranny of the int: 
 let’s send some floats!
  • 37. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Custom Types: Basics • Set up Spacebrew pub + sub as usual,
 but use any name (e.g. float) • Add the onCustomMessage function to listen • When you send, do two things: 1. Make sure you use your custom type! 2. Cast your custom data to a string
  • 38. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Custom Type Demo 2 • JSON in Processing • Why JSON? • It’s a simple way to send arbitrary objects • Spacebrew uses it, so all libs have some sort of JSON library included (if there isn’t one built in)
  • 39. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Quick JSON primer • JSON is a simple way to write out objects • JSON is made up of name-value pairs • Names are strings (in quotes!) • Values can be numbers, strings, booleans, arrays, null (empty), or objects
  • 40. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Quick JSON primer • { = start an object • } = end an object • : = between all names and their value • , = between all name-value pairs
 
 {
 “x”:0,
 “y”:0
 }
  • 41. Spacebrew Collab - Parsons D + T - Brett Renfer & Julio Terra Spacebrew Workshop - NYU ITP - Brett Renfer Quick JSON primer { "name":"cool object", "position":{ "x":0, "y":0 }, "candy I like":[ "twizzlers", "ginger snaps" ] }
  • 42. Spacebrew Workshop - NYU ITP - Brett Renfer You Got Served
  • 43. Spacebrew Workshop - NYU ITP - Brett Renfer Running Your Own Server • Why?
 • sandbox.spacebrew.cc is on the slowest AWS tier • Running over the internet introduces some level of latency • Running a local server OR a remote server allows a level of control: only people you choose can route/reroute, break your routes, etc • Allows you to customize the server code if 
 you choose!
  • 44. Spacebrew Workshop - NYU ITP - Brett Renfer Running Your Own Server • How? • Setup! Only needs to be done once
 • Download and install nodejs: www.nodejs.org • Install node dependencies: • npm install ws • npm install forever-monitor
  • 45. Spacebrew Workshop - NYU ITP - Brett Renfer Running Your Own Server • How? • Run! What you’ll do every time:
 • In terminal, cd to the spacebrew directory • Run: node node_server_forever.js
  • 46. Spacebrew Workshop - NYU ITP - Brett Renfer Running Your Own Server Online • How? • If you want to set up your own remote server, we recommend this tutorial (by fellow ITPers!):
 https://vimeo.com/60001410
  • 47. Spacebrew Workshop - NYU ITP - Brett Renfer Persistence • Another advantage of running your own server is you can use the persistent admin • The persistent admin is a separate service that lets you edit, save, load, and persist routes • It allows you to specify specific app routings:
 coolApp -> coolPub to lameApp -> lameSub • It also allows for powerful wild card routings:
 .* -> coolPub to .* -> lameSub • This routes any app that publishes “coolPub” to any other app that subscribes to “lameSub”
  • 48. Spacebrew Workshop - NYU ITP - Brett Renfer Persistence • You can run the persistent admin from the spacebrew directory:
 node node_persistent_admin.js • From the command line, you can list, add, remove, load, and save routes: • list: ls
 • add: add client1Name,pub,client2Name,sub • use .* to create a wildcard
 • remove: remove [index] • you can find an index after add or by listing
 • save / load (just that!) • load is called on start automatically
  • 49. Spacebrew Workshop - NYU ITP - Brett Renfer Binary • A bleeding-edge feature of Spacebrew is sending binary data
 • The sandbox server does not allow you to send binary data, but your own server does!
 • Let’s check out the javascript and openFrameworks image examples
  • 50. Spacebrew Workshop - NYU ITP - Brett Renfer Admin
  • 51. Spacebrew Workshop - NYU ITP - Brett Renfer The Admin API • You don’t just have to use our web interface! • Javascript, openFrameworks and Cinder (Processing soon) support the Admin API • The Admin API subscribes to Spacebrew similar to a client, firing events each time a client connects/ disconnects or changes its pub/sub map • It allows you to view, edit, and add any and all routes in real time! • This allows for apps like the Admin Randomizer from the Zip! Zap! Zow! exercise
  • 52. Spacebrew Workshop - NYU ITP - Brett Renfer The Admin API • Try it out: http://bit.ly/sbslider-admin
 • Let’s look at the Admin API in Javascript
  • 53. Spacebrew Workshop - NYU ITP - Brett Renfer The End @robotconscience [email protected]