Migrate an existing GCM Web app to Firebase Cloud Messaging (FCM) using the instructions in this guide.
Update Server Endpoints
Update your server code to use new FCM endpoints for sending messages
via HTTP and XMPP. Note that the new FCM version of
fcm.googleapis.com/fcm/ (without "http"):
|GCM endpoint||FCM endpoint|
FCM supports HTTP and XMPP protocols that are virtually identical to the GCM server protocols, so you don't need to update your sending logic for the migration. Optionally, you may want to evaluate the FCM HTTP v1 API, which offers an improved security model and new capabilities for customizing messages across platforms.
Adopt the FCM client SDK by following the
getting started guide.
chrome.gcm functions are similar to
firebase.messaging functions, such as
firebase.messaging().onMessage. Others, such as
are not supported by the FCM client SDK.
Update Web Push API usage
- If you’re using the GCM JSON protocol to send to Push API clients, extract the registration_id from PushSubscription.endpoint to be able to send to specific end users with FCM.
- Make sure you’re using the updated server endpoints above to send messages.
Next steps and optional migration tasks
Get started with FCM
Follow the getting started guide.
Update Web Push API
Use the Web Push APIs without FCM
If you don’t want to use the FCM JS SDK, see the getting started guide for Web Push Notifications. If you'd like to access FCM features without onboarding the FCM JS SDK, you can use the InstanceID Server API to upload PushSubscriptions to FCM and access features like topic messaging.