Eneris / push-receiver

A library to subscribe to GCM/FCM and receive notifications within a node process.
https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0
MIT License
16 stars 15 forks source link

Legacy FCM APIs will be removed in June 2024 #15

Closed juangvega closed 4 months ago

juangvega commented 4 months ago

These endpoints will stop working next month: const FCM_SUBSCRIBE = 'https://fcm.googleapis.com/fcm/connect/subscribe' const FCM_ENDPOINT = 'https://fcm.googleapis.com/fcm/send'

https://firebase.google.com/support/faq#fcm-23-deprecation https://firebase.google.com/docs/cloud-messaging/migrate-v1

Eneris commented 4 months ago

Thanks for bringing it up. I'll check out the upgrade posibility. In mean time, feel free to add whatever you find. Thanks :)

juangvega commented 4 months ago

I found this. It is an upgraded version of MatthieuLemoine/push-receiver with the new endpoints.

https://github.com/MatthieuLemoine/push-receiver/compare/master...javajuice1337:push-receiver-v2:master

Eneris commented 4 months ago

Thanks for the detective work. I'll attempt to transplant the changes within a few days and see if it works. Help is always appreciated :)

Eneris commented 4 months ago

It's looking good. Got a working version. There are some new requests and token refreshing that needs to be done before I release the changes. Also there are some data changes so old tokens are probably gonna need to be re-generated

Eneris commented 4 months ago

@juangvega I've created a new version. Can you please double check form that is's working as expected? https://www.npmjs.com/package/@eneris/push-receiver/v/4.0.1-beta

juangvega commented 4 months ago

Hi there! This is great news. I will try later and let you know. Thanks

Eneris commented 4 months ago

Seems to be working well

tsightler commented 3 months ago

@Eneris Thanks for your work on updating the FCM API. I'm preparing to update ring-client-api which heavily depends on push-receiver, however, it's not clear to me what the upgrade/migration process from older versions might be. Do I need to generate an FCM project for my specific project?

I'll try to look through the source code to get a better clue, but just doesn't feel very clear to me right now what firebase property should contain so if you have any hints it would be appreciated.

Eneris commented 3 months ago

@Eneris Thanks for your work on updating the FCM API. I'm preparing to update ring-client-api which heavily depends on push-receiver, however, it's not clear to me what the upgrade/migration process from older versions might be. Do I need to generate an FCM project for my specific project?

I'll try to look through the source code to get a better clue, but just doesn't feel very clear to me right now what firebase property should contain so if you have any hints it would be appreciated.

Hi. Yea. The firebase project is required now (the free tier will do fine). Just copy-paste the config that firebase gives you for the web apps. https://github.com/Eneris/push-receiver/blob/master/src/types.ts#L119-L128 These parts of the config are required

{
    projectId: string
    appId: string
    apiKey: string
    messagingSenderId: string
}

As for migration steps:

https://firebase.google.com/docs/web/setup Follow the Step 1. here and firebaseConfig from Step 2. is what you need here

Web credentials for firebase are public so don't worry about compiling them into the code