A modern approach to building "real-time" or "live" applications are stream-based frameworks such as ReactiveX,
which describes the API of a class of streaming frameworks in over 18 languages.
These frameworks provide abstractions for data streams together with an extensive collection of built-in
operators to transform and combine them.
Consider a temperature monitoring application that visualises live measurements of many heterogenous
sensors.
Depending on units of measurement and user preferences, measurements may have to be transformed from one
unit to another.
This can be done by mapping a conversion function over a stream of measurements using some built-in
map
operator, resulting in a new stream of data.
Streaming frameworks are often designed sequentially, i.e. new input data is first propagated to all connected streams before the next input can be accepted, and parallelising this process is non-trivial. With composable behaviours we can design a simple framework where streams and operators are actors, such that multiple computations can run in parallel.

Figure 1: Composition of behaviours in an actor-based streaming framework.
Figure 1 depicts the different behaviours involved in our streaming framework.
Every behaviour lists the methods that it provides, and for clarity we also list when a behaviour
expects a certain method to be present in its composer that it does not implement itself.
The framework provides a WebWorkerStream
behaviour to spawn a web worker and to abstract
over its messages as a data stream, and also 1 built-in Map
operator to map a function over
a stream. Common functionality for operators is factored out into an Operator
behaviour
(which also behaves like a stream), and common functionality of streams is factored out into Stream
and Subscribable
. Stream
implements functionality for publishing and receiving
values, Subscribable
simply keeps a list of other streams (actors) that should receive new
publications.
This page contains all of the necessary code to implement this framework as a minimal proof of concept. Scripts loaded by this webpage are:
- stella-evaluator.js: Bundled package of the runtime of the prototype Stella language. A Stella program is represented by a string in standard JavaScript, which is compiled/analysed and evaluated.
- worker.js: A file that implements the logic of a simple Web Worker that emits 1 number per second.
- Stella source code: The Stella program that is run can be viewed directly in the source code of this page which can be viewed in the browser. Below we briefly sum up each of the behaviours.