Quiero enviar notificaciones push desde un archivo de Python a Chrome. Además, quiero dar una opción para abrir un tablero a través de la notificación Push.
¿Qué se puede usar aquí? No planeo usar aplicaciones de terceros como OneSignal, ya que tengo que implementar esto en producción.
Realmente buscando algunas sugerencias.
También he creado una extensión web que crea una notificación automática con la siguiente información:
( Problema : - Este mensaje es estático . Quiero que se actualice dinámicamente .
- Also, I want it the event to be something else apart from click. So that it shows the information once it's updated )manifiesto.json:
{ "name": "Check Dashboard", "version": "1.0", "content_scripts": [ { "matches": ["http://*/*", "https://*/*"], "js": [ "js/app.js" ] } ], "background" : { "scripts" : ["js/background.js"], "persistent": false }, "permissions": ["notifications"], "browser_action": { "default_icon": "icon.png" }, "manifest_version": 2 }aplicación.js:
console.log('Greet bot!'); const button = document.createElement('button'); button.textContent = 'Check Dashboard!' document.body.insertAdjacentElement('afterbegin', button); button.addEventListener('click', () => { chrome.runtime.sendMessage('', { type: 'notification', options: { title: 'Kafka Alerts', message: 'Message', iconUrl: '/icon.png', type: 'basic' } }); });fondo.js:
chrome.runtime.onMessage.addListener(data => { if (data.type === 'notification') { chrome.notifications.create('', data.options); } });