messaging

messaging(app) returns firebase.messaging.Messaging

Gets the Messaging service for the default app or a given app.

firebase.messaging() can be called with no arguments to access the default app's Messaging service or as firebase.messaging(app) to access the Messaging service associated with a specific app.

Calling firebase.messaging() in a service worker results in Firebase generating notifications if the push message payload has a notification parameter.

Parameter

app

Optional

firebase.app.App

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

Value must not be null.

Returns

non-null firebase.messaging.Messaging 

Examples

// Get the Messaging service for the default app
var defaultMessaging = firebase.messaging();
// Get the Messaging service for a given app
var otherMessaging = firebase.messaging(otherApp);

Interface