Discuss Scratch

PullJosh
Scratcher
1000+ posts

The new cloud infustructure!

This is awesome! Websockets are a huge upgrade.

For anybody who is curious about why this is an improvement, and doesn't know much about websockets:
The Old System (HTTP requests):
The old cloud data system used HTTP requests, which are the same things used to request a webpage, or submit a form. HTTP requests are a one-way street. A Scratch user's computer (the “client”) would send a message to the Scratch server (such as “set this cloud variable to be 5” or “give me the data stored in each cloud variable”), and then the server would send a response back. With HTTP requests, the server can never be the first to send a message. To check if the cloud variables were updated, the user's computer would have to be constantly sending new requests to the server and looking for changes. This wasn't very efficient.

The New System (Websockets):
The new system uses something different: websockets. Websockets are different from HTTP requests in one really significant way: They're a two-way street. When you load up a scratch project with the new cloud system, a websocket connection is opened. Then, whenever your computer changes a cloud variable, it sends a message to the server using websockets. But your computer does not have to continually send HTTP requests polling for changes. Instead, the server can send a message of its own (rather than just responses). So when the server finds out that a cloud variable has changed, it sends a message to every computer running the project. All of them are notified of the change and updated accordingly. This makes for a much simpler, cleaner, and more efficient system.
If you're making a website of your own and want to add websockets (so you can have fancy live features like this), socket.io is a good place to start. (If you aren't using node, there are other libraries available to help you out as well, although you'll have to do a bit of research yourself.)
PullJosh
Scratcher
1000+ posts

The new cloud infustructure!

On github:

thisandagain wrote:

The goal is to get everyone moved over to this new websocket-based system in the short term and then we'll continue to evaluate and add new features on top of this new infrastructure after Scratch 3.0 is released.
This makes it sound like non-numeric cloud variables (i.e. including text in cloud vars) are coming our way. Obviously, the Scratch 3.0 release isn't planned until 2018, so there's still going to be a bit of a wait, but things are heading in the right direction.

Although I've done my fair share of complaining about the new Scratch interface, the program itself is actually talking a huge step in the right direction. With custom reporter blocks and now some cloud variable updates, I'm feeling good about the technical side of Scratch 3.0.

(The form-over-function design has still left me Scratching my head, though.)
comp09
Scratcher
1000+ posts

The new cloud infustructure!

Random suggestion: use Protocol Buffers to save CPU and bandwidth. There's a nice JavaScript library for it too: https://github.com/dcodeIO/protobuf.js


Visit the website of Andrew Sun!


IcyCoder
Scratcher
1000+ posts

The new cloud infustructure!

Did anyone find any new bugs?

Because JS is the future (echos) future future futur futu fut fu f
herohamp
Scratcher
1000+ posts

The new cloud infustructure!

TheUltimatum
Scratcher
1000+ posts

The new cloud infustructure!

herohamp wrote:

IcyCoder wrote:

Did anyone find any new bugs?
Not letting me store 10gb of data on it
I sad.
IcyCoder
Scratcher
1000+ posts

The new cloud infustructure!

TheUltimatum wrote:

herohamp wrote:

IcyCoder wrote:

Did anyone find any new bugs?
Not letting me store 10gb of data on it
I sad.
Boo we need unlimited storage.

Because JS is the future (echos) future future futur futu fut fu f
banbot2
Scratcher
100+ posts

The new cloud infustructure!

https://scratch.mit.edu/projects/172591974/ for testing the new cloud.

I eat blocks for breakfast (and lunch, occasionally ).
Awesome logo made by @Pexold.
Mole_Gaming
Scratcher
100+ posts

The new cloud infustructure!

aw heck I just made a testing one too lol https://scratch.mit.edu/projects/172706278/ https://scratch.mit.edu/projects/172706278/?newcloud

Edit: I guess mine doesn't need a separate server to set the cloud variables since all the testing is in-project but just takes a heck lot longer

Last edited by Mole_Gaming (Aug. 30, 2017 22:12:14)


am can program above good
IcyCoder
Scratcher
1000+ posts

The new cloud infustructure!

Mole_Gaming wrote:

aw heck I just made a testing one too lol https://scratch.mit.edu/projects/172706278/ https://scratch.mit.edu/projects/172706278/?newcloud

Edit: I guess mine doesn't need a separate server to set the cloud variables since all the testing is in-project but just takes a heck lot longer
404

Because JS is the future (echos) future future futur futu fut fu f
Mole_Gaming
Scratcher
100+ posts

The new cloud infustructure!

IcyCoder wrote:

404

Whoops forgot to share it lol

am can program above good
-Io-
Scratcher
1000+ posts

The new cloud infustructure!

Mole_Gaming wrote:

aw heck I just made a testing one too lol https://scratch.mit.edu/projects/172706278/ https://scratch.mit.edu/projects/172706278/?newcloud

Edit: I guess mine doesn't need a separate server to set the cloud variables since all the testing is in-project but just takes a heck lot longer
TheLogFather's doesn't need a server either, he just sets the vars differently on the old Cloud and the new Cloud

Very clever

Mole_Gaming
Scratcher
100+ posts

The new cloud infustructure!

Oh I get it now, there's two different sets of variables for each infrastructure type. I thought it would just change the behavior

am can program above good
applepie2
Scratcher
48 posts

The new cloud infustructure!

OMG cloud data finally works with this!!! Before I would set the cloud variable, and it would change back to before I set it like a second later! This is awesome!
IcyCoder
Scratcher
1000+ posts

The new cloud infustructure!

News! https://github.com/LLK/scratch-flash/issues/1211#issuecomment-328386028

Because JS is the future (echos) future future futur futu fut fu f

Powered by DjangoBB