webaverse / xrpackage

XR (VR+AR) web object packaging core API
https://xrpackage.org/
24 stars 10 forks source link

Backend Service Worker (?) #120

Open avaer opened 4 years ago

avaer commented 4 years ago

Right now we use a service worker, mostly for reasons of unpacking and serving local packages. However, this has a lot of downsides associated with it:

However, this code could be moved to the backend. We could, instead of running a local service worker, write a package loading API on the backend, which would pull files from the package based on hash and path:

https://content.exokit.org/Qmfdssfsdjgkdjghjkg/index.html
https://content.exokit.org/Qmfdssfsdjgkdjghjkg/src/three.js

With proper caching this might end up faster too.

avaer commented 4 years ago

Note that this implementation would require that any packages to be loaded are placed on the backend first (you couldn't just load a local file without a server).

avaer commented 4 years ago

Some of the CORS issues might be addressable by WebGPU in the future, if it can interoperate with WebGL.

avaer commented 4 years ago

Also, I suspect the way to implement this would be Lambda or Cloudflare, or a usual cached script on our backed -- we would route some something like this to the unpacker:

https://exokit.org/_package/Qmfdssfsdjgkdjghjkg/src/three.js