Remix.run Logo
loloquwowndueo 4 days ago

The amount of state that early video games stored in like 256 bytes of ram was actually quite impressive. I bet with some creativity one could do similarly for a web app. Just don’t use gzipped b64-encoded json as your in-url state store!

sehugg 4 days ago | parent | next [-]

My 8-bit IDE lets you share your ROM as a lzg/b64-encoded URL. Things get dicey when you go above 2000 characters or so.

loloquwowndueo 3 days ago | parent [-]

URL please :)

wild_egg 4 days ago | parent | prev [-]

With a custom compression dictionary made against your JSON schema, I would bet you could still pack a surprising amount of data into 256 bytes that way.

skrebbel 4 days ago | parent [-]

I tried this once and discovered that for us it worked even better when populating the dictionary with a bunch of commonly seen URLs. Like that includes the same field names as the json schema, but none of the other JSON Schema cruft, and it also includes commonly used values etc. It seemed like the smarter I tried to be, the worse the results got.

I just used Pako.js which accepts a `{ dictionary: string }` option. Concat a bunch of common URL together, done.

The only downside (with both our approaches) is if you add substantially many new fields / common values later on, you need to update the dictionary, and then old URLs don't work, so you'd need some sort of versioning scheme and use the right dictionary for the right version.