open-audiovisual
Search GitHub

oav-p5 reference · Loading options

relay#

optionoav-p5
?oav_relay=a ws:// or wss:// address

The address of the relay that phones and link rooms talk through: a WebSocket URL.

The 📱 button shows a QR code that sends a phone to the remote page, and the phone's MIDI tab plays your sketch through this relay. link rooms use it too. The default is the project's public relay. To keep your traffic on your own machine, run the relay from a checkout of the repository with node packages/relay/server.js and point relay at ws://localhost:7458/relay.

Type
String (URL)
Values
a ws:// or wss:// address
default
wss://remote.cheyuwu.com/relay

Used as given.

Notes

  • Nothing connects to it at load. It is used when you open the 📱 card (OAVp5.phone()) or set link.
  • Set it before oav-p5 loads. window.OAV_P5 = { relay: … }; above the loader line wins, then ?oav_relay=… on the page address, then ?relay=… on the script's own URL. Values in window.OAV_P5 are turned into text, so write 'off', not false. On OpenProcessing the page address takes ?sketch_oav_relay=… (the project's README says OpenProcessing forwards it to the sketch).

Examples

jsOpenProcessing ↗
window.OAV_P5 = { relay: 'ws://localhost:7458/relay' };

function setup() {
  createCanvas(400, 300);
}

function draw() {
  background(20);
  fill(255);
  text('relay: ' + OAVp5.options.relay, 20, 30);   // used when you open 📱 or set link
}
The sketch only prints the address in use: a phone or a linked page would now connect to a relay on your own computer.

Related

  • room The name of the room phones join to play this page: by default one made up per browser.
  • remote The address of the remote page that the 📱 QR code opens on a phone.
  • link Joins a room: oav-p5 pages with the same room hear what each other's programs play, over the relay. A room name, or empty for none.
  • OAVp5.phone() Shows the 📱 card: a QR code that sends a phone to the remote page, whose MIDI tab then plays this sketch. Returns the room name.

p5/oav-p5.js, line 127

↑ Back to top · All names