Understand the Ableton.js communication protocol
masterAbleton.js communicates with the MIDI Script via UDP using JSON objects.
Command Structure
A command payload includes:
uuid: A unique command ID for associating requests and responses.ns: The command namespace (e.g.,song).nsid: The namespace ID (e.g., to address a specific track).name: The command name (e.g.,get_prop).args: Arguments for the command.etag: An MD5 hash used for caching.cache: Boolean indicating if the plugin should use ETag caching.
Response Structure
The script responds with:
data: The return value (JSON-compatible).event: Eitherresultorerror.uuid: The original command UUID.
Caching Mechanism
To reduce UDP bandwidth, the library uses an LRU cache and ETags. If the plugin determines the data hasn't changed, it returns a placeholder object: { "__cached": true }.