Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

405
Views
FCM - Cómo enviar y mostrar notificaciones desde la aplicación vue

Tengo una aplicación que se ejecuta en firebase BaaS. Necesito enviar notificaciones a un usuario específico cuando ocurre una acción y al mismo tiempo recuperar la notificación para mostrarla.

Seguí una guía y la documentación para implementarla en mi trabajador de servicio y pude recibir una notificación registrada en la consola con este código cuando usaba la consola de Firebase.

 importScripts('https://www.gstatic.com/firebasejs/9.1.3/firebase-app-compat.js'); importScripts('https://www.gstatic.com/firebasejs/9.1.3/firebase-messaging-compat.js'); firebase.initializeApp({ apiKey: "...", authDomain: "...firebaseapp.com", databaseURL: "https://...-default-rtdb.firebaseio.com", projectId: "...", storageBucket: "...appspot.com", messagingSenderId: "...", appId: "...", measurementId: "..." }); // Retrieve an instance of Firebase Messaging so that it can handle background // messages. const messaging = firebase.messaging(); messaging.onBackgroundMessage( (payload) => { console.log('[firebase-messaging-sw.js] Received background message ', payload); // Customize notification here for 'data' key let { data } = payload if( data && data.title && data.body ) { const notificationTitle = data.title || 'Test title'; const notificationOptions = { body: data.body || 'Test body', }; self.registration.showNotification(notificationTitle, notificationOptions); } }); self.addEventListener('notificationclick', (event) => { let { notification } = event; // this event will not be occoured by notication of FCM 'notification' key console.log('[firebase-messaging-sw.js] Notification clicked: ', event); notification.close() });

Dado que el usuario final no tendrá acceso a la consola Firebase FCM, ¿cómo puedo agregar la capacidad de enviar una notificación desde mi aplicación vue y cómo puedo recuperarla cuando se recibe una notificación?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!