My mqtt based cloud database

i've created a cloud engine capable of sharing and storing data and i'd love for some feedback
link:Snap! Build Your Own Blocks

The way you are implementing this will not work.

Let me show you:

  • This "cloud" variable is set:
    cloud-database-utilities script pic

  • I clear my local storage to simulate a fresh PC (you are storing things there):

  • I reload the page

Where did the data go?

cloud-database-utilities script pic (1)

I've tried to explain this to you several times. If you don't have a proper backend, these "cloud variables" will not work.

[removed, sorry for being rude]

every time we have told you this wont work

There is nothing terribly wrong with the concept of "cloud variables" implemented as an MQTT "retained" message. This script should immediately display the last message stored at the MQTT backend

cloud-database-utilities script pic

published earlier as "retained" with

cloud-database-utilities script pic (1)

It actually does, with the "retained" attribute (depending on the server implementation).

However, based on a previous post from @cymplecy, it seems that you can erase such values accidentally very easily. A cloud backend specifically made for cloud variables would be better and possibly even more secure.

Please count to 10 slowly before posting. Cut people a break; we're all children here.

sorry about that it was like 10pm when i posted that and my brain wasnt thinking at 100% compacity

i just updated it
fixed some bug
added quality of life improvements etc.
let me know what you think about the update

also @bh do you think this could be added as a library for snap

I'm kinda dissuaded by

I would want something rugged before offering a library. Eventually we may be able to do that ourselves. No promises.


i have a cloud backend for a project im working on that uses an embedded snap project that has mqtt code in it hosted by replit and using uptime robot

You are hosting Snap! as a Node app or in the nix-env browser?

no, i think they have a bash terminal or something like that set up to open a browser with a snap project loaded in replit. unfortunately, this method won't work anymore on the free plan due to replit's new hosting restrictions

I don't think a library should rely on third party commercial servers. Ideally we shouldn't depend on any external service, which might disappear. If we want cloud variables (not settled) we should serve them ourselves.

Maybe you could make it so they are only stored for a set amount of time. Then maybe based on the popularity of the project, the cloud variables are stored longer.

I also had this other idea, that would be extremely hard to implement, but maybe you could have a network of computers using the snap website connect via WebRTC or something. Whenever a cloud variable is set, you can send it out to all the computers and a few of them can store it into memory. Then occasionally, the computers with these values in memory will send them off to other computers, so when one goes offline, the value is still stored in a different computer. When we want to get a value from a different device from this network of computers, we could send a message requesting for the value to be sent to the requester of the value. If a device sets a cloud variable and then calls it again, it should just recall from its own memory. There could be a cooldown for each request (like 0.5 seconds or something) so we don't overload the network with messages. This is a really dumb idea and it relies on the popularity of the Snap! website to be able to function.

no i just embedded a snap project into an html file, had replit host it, and used uptime robot to keep it up

what did they do?

all projects are moving the site and your repl will only be on if someone is active in the editor

Bzzzt! Thanks for playing.

(That's a quote from Dead Poets Society, in case you haven't see it.)

why do you have to put "the greatest" in front of everything? i'm not saying your projects are bad, because they're good and unique, i just dont think they are "the greatest".