Estoy usando Firebase Messaging para las notificaciones del navegador. El problema es cuando hay varias pestañas abiertas. Se muestra una notificación para cada pestaña. Agregar una tag a las opciones no ayudó
firebase.initializeApp(constants.CONFIG); const messaging = firebase.messaging(); messaging.setBackgroundMessageHandler(({ data }) => { const options = { body: data.body, data: { link: data.link, }, icon: data.icon, }; const backgroundNotification = self.registration.showNotification(data.title, options); return backgroundNotification; });Solo necesito que se muestre una notificación incluso cuando hay muchas pestañas abiertas con la misma aplicación
Comenta esta línea de código
const backgroundNotification = self.registration.showNotification(data.title, options);y usar en su lugar
new Notification(notification.title, { body : notification.body, tag : notification.title, icon : notification.icon });Ejemplo 3.5: https://notifications.spec.whatwg.org/