What is Firebase Cloud Messaging?
Firebase Cloud Messaging (FCM) is a service that enables developers to send and receive messages across platforms.
Firebase Cloud Messaging offers the following key capabilities: [1]
- Notification or data messages
The user receives notifications such as information about a specific event
- Versatile message targeting
You can define whether a message is distributed to a specific device, to a group of devices or based on a predefined topic.
- Send messages from client apps
It is possible to send messages from a device/client to the server.
How does Firebase Cloud Messaging work?
The Firebase cloud messaging architecture can be divided into 4 sections and is shown in the following illustration. The basis (1) is a server environment. This can be a separate app server or Cloud Functions for Firebase. It is responsible for creating, targeting and sending messages. This is followed by the Firebase cloud messaging backend (2), which receives and distributes message requests. (3) represents the transport layer, which forwards messages to the corresponding end devices. These can be Google Play services, Apple Push Services or web push protocols. The end device that finally displays the message forms the end of the chain (4).

A message transmitted by FCM is structured in JSON format and looks something like this:
{
"message":{
"token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"notification":{
"title":"Dies ist der Titel",
"body":"Hallo, dies ist eine Testnachricht"
}
}
}
The message can be clearly assigned using the token. The "notification" attribute contains the message and is divided into "title" for the subject and body for the actual message content.
Should I use Firebase Cloud Messaging?
FCM offers a wide range of applications. FCM is particularly useful for informing users in real time about updates or new content within the app. It can also be used to set up simple chat functions. Notifications can be triggered both automatically and manually, allowing flexible communication with users. Using the Firebase cloud messaging service also eliminates the need to take care of network communication yourself. Finally, the FCM service is basically completely free of charge. However, indirect costs may be incurred, for example through the use of cloud storage. If a large number of messages are stored there, costs may be incurred [5]
Learn more about frontend development
[1] Firebase Cloud Messaging
[2] Firebase cloud messaging documentation
[3] Firebase Cloud Messaging Architecture
[4] Firebase Cloud Messaging Architecture Illustration
[5] Firebase cloud messaging costs



