feat: check scratch cloud status
Currently when scratch cloud is down it outputs a cryptic error. Ideally, it should ping cloud data server to check if its up and tell the user.
There is a principle called "It's easier to ask for forgiveness than permission", that would be violated this way. It would also slow down start-up time.
Unless you mean after there is an error, but afaik it is possible to tell why it is failing by inspecting the error. Are you suggesting to improve errors?
I think maybe we could add a suggestion that the cloud server may be down instead of giving a 'cryptic' error (about websockets). In addition, we maybe could make some kind of badge on the README/webpage (maybe using vercel) to show the status of the scratch cloud.
I'm not sure if this would work (maybe check next time cloud vars are down). Also, if we want to make this a zero-cost check, you can check for cloud vars being down only if you get a websocket (handshake) error. This way, it has no cost most of the time (although that cost is probably negligible anyway).
I do think it may be worth trying to make this issue more clear because there is a significant portion of issues related to the scratch cloud being down, which, if we added this as an error message, would not be so common.
there could be a sa.check_cloud_status() method that allows scratchattach users to get the current status of scratch's cloud var
the url I linked is now giving 502 bad gateway. if cloud is down, then i think it can be used
there could be a sa.check_cloud_status() method that allows scratchattach users to get the current status of scratch's cloud var
that could be used internally for the error message too
https://scratch.mit.edu/projects/1240769388/
This project uses Scratchattach to test cloud variables. It connects to the server, changes a variable, and if the server sees one, sends a change in response. If your device sees the change, it will know it is online. I have tested this and it has very high accuracy. (I created it on another account)
**Update: **
This could work! Scratch cloud just came back online for a brief moment and I checked the server and got this response
You could make a very simple request to it and if you get a response, show online. However, this server seems REALLY patchy. I reload 10 times and only 3 of those show a response.
I just made a pull request with this function added to scratchattach
there is now a function to fetch the cloud status. this dhould be called in the error printer for this error. however do note that this status checker is only for scratch cloud
That's really not an issue, as Turbowarp Cloud has never had major issues like scratch has.
fixed by #536