ServiceWorker Payload and Push Notification

Community:

ServiceWorker is a great cutting edge technology in terms of cache management, but I have some questions related to other operations such as:

Push Notification: I did the integration of GCM (Google Clud Message) and NodeJS following this article , the problem is that when GCM sends information to client (Chorme), the message payload generated by GCM is not available in Notification in ServiceWorker Listener, which was would be great for making decisions. Any idea when the data payload in notifications will be enabled?

Registration: Since ES6 is very mature, it would be nice to register the ServiceWorker in other ways, for example:

import sw from './sw.js'

navigator.serviceWorker.register(sw, {scope: '/'}).then(function (registration) {
 // Registration was successful
 console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function (err) {
 // registration failed :(
 console.log('ServiceWorker registration failed: ', err);
});

      

Is this possible or makes sense?

Thank!!!!

+3


source to share


1 answer


  • " Support for encrypted payloads for push messages " bug tracks the progress of receiving payloads in notifications. This bug is specific to Chrome, but other browser vendors are likely to take the same approach.
  • The service worker update flow is very tied to the idea of ​​having a specific JavaScript file that represents the worker code, and this file can be periodically checked byte by byte to see if there are any updates. If it was a memory-based JavaScript object that was registered, detached from the file, the update stream would not work as specified. I don't think you will see the changes that you suggest adding to the spec.


+2


source







All Articles