Does Processing have something equivalent to a "cloud variable"?

In Scratch, a cloud variable is a variable that is stored in the cloud. So if someone on one computer changes it, anyone using that scetch on a different computer will see the variable change. Is there a way to do this in Processing?

3 Likes

Hi.
You can upload and get strings.
See this topic.

https://processing.org/reference/loadStrings_.html

add some LOCAL server and networking options for processing
i summarized here

2 Likes

kll ‘s upload code is a good real solution. I didn’ even know that this is possible with Processing. But if you haven’t an own domain you could maybe use the google’s bucket lib.

1 Like

Interesting! I wasn’t familiar with the Scratch “Cloud Data” system.

Cloud data is a feature that allows users to store variables “in the cloud,” or on the server.

So, this works because the Scratch community has a central hosting architecture, and a single server infrastructure backing it through a single website.

You could imagine a feature like being added to, for example, the p5.js web editor at editor.p5js.org, or as an extension to OpenProcessing services at openprocessing.org – a hosting service with a single server.

Absent that, the question is how to roll your own. Then there are dozens of options for putting / editing information somewhere on the internet and retrieving it:

  1. use a web-hosted database and update values in the database
  2. run a server sketch at a stable IP address, and have it send and receive network messages to update central variables in memory
  3. work with a library that accesses a third-party hosted database, such as Firebase
  4. work with a library that accesses a hosted key-value store (self-hosted or not), such as Redis-processing + openredis

Still, it having all that invisibly managed as a free web-hosted service would be a great feature – but by default, Processing is decentralized and PC oriented. Somebody would need to set up e.g. a redis server and create a library for people to add that easily interfaced with it, plus put some account / API-key / policies into place. That’s a lot harder than adding it as a feature to something like openprocessing.org, where you already have user accounts, passwords, and a namespace for every sketch that runs.

2 Likes