Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK Migration from pn_gcm to pn_fcm (HTTP v1 FCM) #370

Open
roman-rr opened this issue May 15, 2024 · 0 comments
Open

SDK Migration from pn_gcm to pn_fcm (HTTP v1 FCM) #370

roman-rr opened this issue May 15, 2024 · 0 comments

Comments

@roman-rr
Copy link

As its mentioned here and here
Notification Payload should be updated from gcm to new fcm standard.
And pn_gcm must be turned into pn_fcm.
And here is several migration concernings described below.

Building message payload

To build payload I am using NotificationsPayload class and buildPayload function (from this SDK).
As we can see, buildPayload at this SDK still assign pn_gcm to payload.

Finally, my message payload to be published is:

{
  "message": {
    "body": {
        // Some payload
    },
    "pn_gcm": { // Here is important to keep pn_gcm, otherwise it won't works.
      "notification": {
        "title": "New Message",
        "body": "Charlie has sent you a new message.",
        "sound": "notification.wav",
        "android_channel_id": "1:8768586xxxxx:web:958xxxx"
      }
    }
  },
  "channel": "XXXXXX-XXXXX"
}

Replacing pn_gcm to pn_fcm will not works, as i tried it serveral times.
Notifications won't be received in iOS/Android.

Server Side Processing Updates

I guess, my pn_gcm will automatically processed into new FCM v1 format at PubNub server-side layer:

"fcm": {
  "notification": {
    "title": "New Message",
    "body": "Charlie has sent you a new message.",
    "sound": "notification.wav"
  },
  "android": {
    "notification": {
       "sound": "notification.wav"
     }
  }
}

And it is working right now with pn_gcm as described here, but not pn_fcm:

PubNub will continue to support the existing pn_gcm object for simple payloads. Since pn_gcm was based on an older and incompatible spec, the push server will attempt to remap the payload to the new FCM spec.
However, it will only work in some cases. Because the older spec was more forgiving, a payload that worked previously would be rejected as an error with the new FCM.

Addition consideration on SDK updates

Additionally, here pushGateway prop at addChannels function is still using apns2 | gcm.
Don't sure if it's still relevant or have to be migrated into apns2 | fcm.

Main Questions

  1. Should this SDK change pn_gcm to pn_fcm at this code lines ?
  2. Should pushGateway to be updated into apns2 | fcm ?
  3. Should buildPayload need to be updated according to new Payload format ?
  4. Do I need to do something extra for my app codebase in case that now Notifications works well, or PubNub (Server team + SDK team) will handle migration on side itself?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant