3.5. Events and data travel through cables

Let’s take yet another look at this composition that displays text in a window:

The lines connecting the nodes are called cables. Cables are the conduits that data and events travel through.

In the composition above, an event travels along the cable from the Started trigger port of the Fire on Start node to the Text port of the Make Text Image node. An event and data travel along the cable from the Make Text Image node to the Render Image to Window node’s Image port. Notice the difference between the two cables: the first cable is thinner since it only carries events, while the second cable is thicker since it carries both events and data.

Often it helps to think of cables as pipes that data and events flow through. Like water flowing through a pipe, events and data flow through the cable from one end to the other, always in the same direction. Extending the water analogy, you can think of trigger ports as being upstream and the nodes that their events flow to as being downstream.

But, unlike water flowing through a pipe, events and data travel as discrete packets instead of a continuous flow. Another way to think of a cable is as a one-way, one-lane road on which each event is a car. On some roads (data-and-event cables), each car carries a piece of data.

Data can’t travel along a cable by itself. It always needs an event.

In the Vuo Editor, you can create a cable by dragging the mouse from one port to another. While you’re dragging, the ports that you’re allowed to connect the cable to are highlighted. If you’re not allowed to connect a cable from one port to another, it’s because the two ports have different, incompatible types of data. For example, you can’t connect a port whose data is a number to a port whose data is a 3D model.