Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
Firebase javascript v9 getMessaging().subscribeToTopic() indefinido

Estoy usando firebase javascript api v9 en mi proyecto de reacción y estoy usando el siguiente código como lo sugiere la documentación oficial

import { getMessaging } from "firebase/messaging"; // These registration tokens come from the client FCM SDKs. const registrationTokens = [ 'fcm_token_string' ]; // Subscribe the devices corresponding to the registration tokens to the topic getMessaging().subscribeToTopic(registrationTokens, topic) .then((response) => { // See the MessagingTopicManagementResponse reference documentation [enter link description here][1]for the contents of response. console.log('Successfully subscribed to topic:', response); }) .catch((error) => { console.log('Error subscribing to topic:', error); });
import { getMessaging } from "firebase/messaging"; // These registration tokens come from the client FCM SDKs. const registrationTokens = [ 'fcm_token_string' ]; // Subscribe the devices corresponding to the registration tokens to the topic getMessaging().subscribeToTopic(registrationTokens, topic) .then((response) => { // See the MessagingTopicManagementResponse reference documentation [enter link description here][1]for the contents of response. console.log('Successfully subscribed to topic:', response); }) .catch((error) => { console.log('Error subscribing to topic:', error); });

Sin embargo, a pesar de hacer exactamente lo que dice la documentación de firebase api v9, no estoy definido cuando accedo a la función getMessaging().subscribeToTopic.

Me pregunto si esta función se movió a otro componente y la documentación se ha vuelto obsoleta.

Apreciaría cualquier ayuda. Gracias de antemano.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No hay forma de suscribir un cliente web a un tema desde el código del lado del cliente (consulte Cómo suscribirse a temas con un navegador web usando Firebase Cloud Messaging ). Por lo tanto, se supone que el código que obtuvo de la documentación se ejecuta en el servidor, usando el SDK de administrador de Firebase para Node.js, que todavía usa la sintaxis con espacio de nombres ...subscribeToTopic() .

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda