
    
        self.addEventListener('push', async function (event) {
				var payload = event.data.json();
                console.log('Push Message: ' + JSON.stringify(payload));
                
        const clients = await self.clients.matchAll();

        if(clients.length){
            console.log('Post message: ' + JSON.stringify(payload));
            clients.forEach((c) => c.postMessage(payload));
        }
     
        });
        self.addEventListener('notificationclick', function(event) {
            event.notification.close();
				if (event.notification.data.url) {
            	event.waitUntil(clients.openWindow(event.notification.data.url));
				}
        });
		  
