How to update a web page in reaction to a push-notification?
How to update a web page in reaction to a push-notification? I am exploring the world of push-notifications in Node.js and have one question. Following a few tutorials, I now have a small app firing a few notifications and those pop up in my web browser as expected. Here is the question: Instead of having a notification popping up, would it be possible to have a field in my web page updated? (For example: a clock or a counter) If the answer is YES, how can I do it? Do I need to change the service worker? The client? Or what? Here is the current code: const SECS = 5 * 1000; let rankVal = 0, counterVal = 1; const notificationLoop = setInterval(() => { let currentDate = new Date(), timeLag = (currentDate-referDate)/1000 const payload = JSON.stringify({ title:'Event is reached!', timeLag:timeLag.toString() }); webPush.sendNotification(subscription,payload).catch(err => console.error(err)); consol...
