The Messaging SDK does not work in a Node.js environment.

Callable

  • messaging(app?: App):Messaging
  • Gets theMessaging service for thedefault app or a given app.

    firebase.messaging() can be called with no arguments to access the defaultapp'sMessaging service or asfirebase.messaging(app) to access theMessaging service associated with aspecific app.

    Callingfirebase.messaging() in a service worker results in Firebasegenerating notifications if the push message payload has anotificationparameter.

    The Messaging SDK does not work in a Node.js environment.

    example
    // Get the Messaging service for the default appvar defaultMessaging = firebase.messaging();
    example
    // Get the Messaging service for a given appvar otherMessaging = firebase.messaging(otherApp);
    namespace

    Parameters

    • Optional app:App

      The app to create a Messaging service for.If not passed, uses the default app.

    ReturnsMessaging

Index

Functions

isSupported

  • isSupported():boolean
  • Returnsboolean

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-09-28 UTC.