cloud-sweeper icon indicating copy to clipboard operation
cloud-sweeper copied to clipboard

investigate: offline strategies

Open getify opened this issue 8 years ago • 5 comments

appcache is widespread but dying. serviceworker is on the rise.

should we use both? neither? etc?

getify avatar Feb 15 '16 14:02 getify

I assume you're just looking at having assets + code cached yes?

joekarl avatar Feb 22 '16 20:02 joekarl

atm, that's what i'm thinking.

but tbh, there might very well be other kinds of offline-ability that would be interesting to discuss. for example, if the game eventually supports high-score boards or other kinds of tracking of your activity in a centralized account, and you're playing offline, maybe something like service-worker (or local-storage or whatever) could be keeping track of your activity and then sync it up when you go back online.

i'd like to have a broad discussion about strategies and options, since I don't really know what is even possible, entirely.

getify avatar Feb 22 '16 20:02 getify

If you ware looking for something low risk and easy you may want to look at the auto.appcache feature we provide with surge.sh. Surge.sh automatically generates an auto.appcache file. All you have to do is link to it in your html tag like so <html manifest="/auto.appcache">

Works in pretty much every browser but like you say, it appears appcache is being EOLed.

Here is a blog post on the topic...

https://davidwalsh.name/dont-wait-serviceworker-adding-offline-support-oneline

sintaxi avatar Feb 22 '16 22:02 sintaxi

I would go with service worker only. Appcache is it not worth the trouble in my opinion. Yes, this way it won't work offline in Safari and Edge at the moment but I am sure they will add support sooner or later and I think the more sites/apps use service worker the faster they will implement it :-)

I made a service worker for the game. Code Demo

And as you mentioned high-score boards, there you could use Background Sync

Happy to make a pull request for this.

justmarkup avatar Feb 24 '16 10:02 justmarkup

Hard to argue with @justmarkup on this, unless iOS support is a requirement.

sintaxi avatar Feb 24 '16 10:02 sintaxi