Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Push : Migrating from GCM to FCM

I am upgrading a website that use Wen Push Notification for Chrome and Firefox. It has been running for last 2 years. It has nearly more than 2-3 Million Subscriber. But now, its servers are slow and that's why it I am migrating web push notification part to AWS lambda for scalable solution as subscribers are increasing.

Note :: It uses pywebpush library for sending push messages.

As project was build very early, It uses GCM Keys instead of Firebase Keys. During Migration, I have found very weird thing that same GCM keys that have been working great from main servers, are not working from aws lambda. And I am getting 401 - Legacy Server Key error. Mozilla web push are working great

I read the GCM documentation and find out that GCM is deprecated. And after April 2019, It will not be working any more. Also, I am not able to see any GCM console. I went to firebase console and created a new project and tried sending push notification with new fcm_key, This time it responded with 200 and MisMatchSenderId, which make sense because this subscription info was taken from google api using gcm sender id. Now I have following questions, if anyone knows the answer please let me know.

  1. How can I migrate current GCM project to FCM project so that my gcm sender id remains same ? Can I ?

  2. Nearly 2-3 million subscribers are subscribed using old GCM sender id, If I can't migrate then what's the solution. Would I loose all of my subscribers or Do I need to resubscribe for every user and get new subscription info ?

  3. If I need to resubscribe for every browser, Would It ask for allow and block permission again ?

You help will be appreciated !!

like image 858
Adil Malik Avatar asked Nov 07 '22 20:11

Adil Malik


1 Answers

  1. Just import your project to the Firebase Console. The GCM Sender ID is actually just the same as the Project's ID -- is unique and permanent. Importing your project to Firebase won't change it.

  2. After you import your GCM project and migrate your servers, the token relationships (i.e. topic subscriptions, device groups, registration tokens in general) should still be usable. See this and this.

Unfortunately I'm not knowledgeable enough to comment on the 3rd item. But from what I can tell from mobile side of things, it's using the same permissions.

like image 99
AL. Avatar answered Nov 15 '22 08:11

AL.