ffd8 / P5LIVE

p5.js collaborative live-coding vj environment!
https://p5live.org
GNU General Public License v3.0
229 stars 35 forks source link

Feature request: Restore cocoding session from localStorage #52

Closed guidobouman closed 3 years ago

guidobouman commented 4 years ago

When the server restarts, each cocoding session is empty after a page refresh. When the session is empty, the cocoding session can potentially offer to restore the session from a local cache copy.

What do you think?

guidobouman commented 4 years ago

If you can point me in the right direction and allow me to pick your brain a little, I think I should be able to write the PR within the next couple of days.

ffd8 commented 4 years ago

Good question – it's intentional that the cocoding session is cleared for a few reasons (mainly speaking of online hosted version):

I see cocoding as a volatile space for jamming/collab. The 'clone sketch' function of cocoding is intended for exactly that archiving of anything you do collaboratively on your local machine. Good to regularly clone the sketch as progress takes place. I had an 'import to session' function for cocoding - where the inititor (or guest with permission) could replace the shared code with a local sketch (especially useful for teaching) – but it ended up having major syncing issues when changing the whole code with 25 students at once (since all delta changes are single keystroke syncs!) – i wanted to find a way to pause the syncing of peeredit rga – then via websockets replace editor contents of everyone – then re-activate the syncing of code (essentially starting over its history), but still haven't found a way. (awesome if you have insight/ideas for that). When that would work – would be really easy to land in a cocoding session and just load your local sketch to the session (like what you describe above). I have that whole funcitonality written in another branch that got put on a pause until solving the rga syncing pause/init issue.

ffd8 commented 3 years ago

Also closing this, as it's addressed above – I want to purge the COCODING sessions, so you don't get put into a room that already has code (potentially malicious) – nevertheless, I updated the code and it now waits 24hrs after the last person left the room to purge everything. I found a bug that was crashing the server every once in a while when trying to track the cursor position of someone who had exited... so now it's been running 25days without an issue = should be far more stable. I think it's best to simply clone your COCODING session to sketches folder and when wanting to reboot things – just paste it in when firing up again. Same for SyncData – you can save whatevers in that editor as a template to pull up again (also overwriting a preset if only updating vars). Lastly, I implemented an 'autoclone' feature incase the websocket server is ever lost (can happen if I have to reset/upgrade the COCODING server) – so hopefully nothing gets lost in this volatile space.