How can we integrate with service workers from Meteor? How would something like minimongo interact with it? Service workers’ navigation seems to be based on REST-like APIs or at least endpoints, which Meteor doesn’t expose, so a package that allows us to still write against the Meteor API but get offline support with service workers could be quite nice.
It would be really nice to have something similar to this or the existing meteor appcache package, where just adding it to the project makes your app serviceworker-compatible.
Progressive Web Apps and Service Workers are getting a lot of attention at the moment. I found this talk form Google I/O particularly engaging.
I’d be very interested to understand how we can best take advantage of this approach for Meteor based apps, and what plans, if any MDG has to integrate and/or enable them.
I personally think this is an important topic for Meteor and here is my humble opinion on this…
Service workers allows granular caching and better user experience in offline mode and adds the support for push notifications, in addition we’ve the ability to add to home screen using the manifest file, components lazy loading using “PRPL” pattern and HTTP/2 support, speed loading the application shell then lazy load the data and the rest of the app are all technologies and design patterns that pushes the mobile web forward.
With such powerful set of technologies in the pipeline it seems that in the future we’ll have less use of Cordova to build connected clients and more progressive web apps will be created.
I think Meteor is the right framework to pioneer the support for those technologies since it made connected clients first class citizen of the web early on…
Service worker matters. Even I’m not sure package API could allow me to register a file to root you can use my Meteor service worker with instructions to put it by yourself in /public and register it here : https://github.com/NitroBAY/meteor-service-worker (it’s still in an early phase).
Please tell me what you think about it.
@nitrobay, thanks a lot for this effort! Indeed, AppCaches are becoming a thing of the past and frankly have major issues. Would you consider your meteor-service-worker production-ready? Tested it and working great so far. Is it still maintained (can we help in anyway). I think this is important for Meteor to be at the forefront of modern web applications.
Hello,
We’re already talking with Ramez on github so if other people see that thread :
AppCaches is indeed a thing of the past so Meteor’s team should support workers https://github.com/meteor/meteor/issues/5982
The repo is still maintained
Thanks @nitrobay, your code is working great! Next, I feel we need two things
We need to explain a bit better requirements on the server side for caching, and help people know it’s working with dev tools
Incorporate approach similar to upup.js to allow fully offline app / prevent needless hit to load from server (when I hit reload it still fetches first HTML from meteor site)
I can help with #1, will need to agree with you on #2
i’ve setup a pwa_manifest.json in my meteor app, but when i add the icon to home screen there is a few seconds delay, and in chrome tool there is a message :
Site cannot be installed: no matching service worker detected. You may need to reload the page, or check that the service worker for the current page also controls the start URL from the manifest
what is the nowadays advice for meteor 1.8 ? should i install the @nitrobay from github? or should i just add something in my manifest ?