Message Passing
Messages are how objects talk to each other in Patchies. Draw a cable from one object's outlet to another's inlet, and data flows along it whenever the source sends something — a number, a string, a bang, or any custom value you like.

In this patch, two slider objects send their values to expr $1 + $2, which adds them and forwards the result to a p5 object for display.
Note: Objects like expr use hot and cold inlets. Only the leftmost inlet (
$1) triggers output — other inlets store their value silently until the hot inlet fires.
Try It

✨ Open this patch to see message passing live.
Exercise 1 — Button chain
- Create two
buttonobjects (Enter→ typebutton) - Connect the outlet of the first to the inlet of the second
- Click the first button — it sends a
bang, causing the second to flash
Exercise 2 — Text message
- Create a
msgobject (Enter→ typem 'hello world'). Mind the single quotes. - Search for the
logger.jspreset and connectmsg→logger.js - Click the message object —
'hello world'appears in the virtual console
Message Types
Most Patchies messages are plain JavaScript values:
| Value | Example | When to use |
|---|---|---|
| Bang | { type: 'bang' } |
Trigger something, no data needed |
| Number | 42, 0.5 |
Sliders, knobs, sensor values |
| String | "hello" |
Text, commands, labels |
| Object | { type: 'note', pitch: 60 } |
Structured data with named fields |
The message box has a shorthand: typing bang sends { type: 'bang' } automatically. To send the literal string "bang", wrap it in quotes.

Sending & Receiving in JavaScript
In any JS-enabled object (js, p5, canvas, hydra, etc.), use send() and recv():
// Send from one object...
send({ type: "bang" });
send(42);
send("hello");
// ...receive it in another
recv((data) => {
console.log("Got:", data);
});
Tip: Drop in the
logger.jspreset and connect anything to it — it prints every incoming message to the virtual console, making it easy to inspect what's flowing through a cable.
See JavaScript Runner for the full API: multiple inlets and outlets, named channels, timers, and more.
Named Channels (Wireless Messaging)
You don't always need a cable. Named channels let objects communicate across any distance in the patch — useful when cables would make the patch hard to read.
Create a send <name> object and a matching recv <name> object anywhere in the patch:
[button] → [send kick] [recv kick] → [p5]
Any message arriving at send kick's inlet immediately appears at every recv kick's outlet — no cable required.
Visual send/recv objects and the JavaScript send()/recv() API share the same channel system and are fully interoperable. See JavaScript Runner for the JS syntax.
See Also
- JavaScript Runner — Full JS API: multiple ports, named channels, timers
- Hot and Cold Inlets — Control when objects trigger output
- Connecting Objects
- Data Types