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

Node GCM doesn't support Apple 'apns-collapse-id' or Android 'collapseKey' #313

Open
jbruggeman opened this issue Nov 16, 2017 · 9 comments

Comments

@jbruggeman
Copy link

jbruggeman commented Nov 16, 2017

Google has added 'apns-collapse-id' and 'collapseKey'. If you're using a non-legacy application it appears iOS 10+ devices will not be able to collapse notifications together.

See https://firebase.google.com/docs/cloud-messaging/concept-options

@eladnava
Copy link
Collaborator

Hi @jbruggeman,
Thanks for the update!

The solution would be for node-gcm to support the new apns-collapse-id flag, right?

@jbruggeman
Copy link
Author

@eladnava

So, looking into it a bit further, google now has two versions of the API. node-gcm looks like it covers the legacy API, but not the new API, which hits a different endpoint. This new API was released within the last month.

Do you think it makes sense to update node-gcm to handle a separate endpoint or perhaps a new wrapper library should be created?

@eladnava
Copy link
Collaborator

Hi @jbruggeman,
That's interesting, can you please link to the article with the new API endpoint info?

It would probably make sense to update node-gcm as long as there are no breaking changes.

@jbruggeman
Copy link
Author

jbruggeman commented Nov 20, 2017

@eladnava
Copy link
Collaborator

eladnava commented Nov 23, 2017

Hi @jbruggeman,
Interesting, thanks for the links. 👍

Regarding collapse keys, node-gcm definitely supports those using the Legacy HTTP API parameter, see the README for syntax:
https://github.com/ToothlessGear/node-gcm#additional-message-options

I think that updating node-gcm to hit the new FCM HTTP v1 API should only be done once there is functionality which is not available in the Legacy HTTP Server Protocol.

@hypesystem fyi

@hypesystem
Copy link
Collaborator

hypesystem commented Nov 23, 2017

I'm not quite sure I understand this correctly.

If it is true that there is no new functionality added (that there is no functionality current unsupported by node-gcm), I agree: we don't need to focus on a new version now.

If you are up for giving it a try, @jbruggeman, it might be cool to see how much would need to change in order to support the new API. I'm assuming that using the new API would still work for old applications, registering with the existing methods on the client side.

@jbruggeman
Copy link
Author

jbruggeman commented Nov 23, 2017

@eladnava @hypesystem Yes, it has a collapseKey, but it will not generate the APNS apns-collapse-id in the resulting message, which is required for collapsing on iOS 10+. Adding this key is only available using the FCM HTTP v1 API.

So yes, there is new functionality added.

I did build a simple implementation wrapping the new API. I used the 'googleapis' package to do token management, and constructed the message according to the spec, and built a simple message queue to do message management.

I'll see what I can do about packaging it up into a releasable package.

@eladnava
Copy link
Collaborator

@jbruggeman Cool, if there is indeed missing functionality we may be forced to update to the new API sooner than later.

Is there any information on the Internet that references the fact that the old Legacy HTTP API does not set the apns-collapse-id flag when the collapse_key parameter is specified?

@hypesystem
Copy link
Collaborator

A source for this would indeed be good, so we can document this current deficiency.

@jbruggeman do you have a subjective opinion on how much has changed between the API we use and the new one? I haven't had time to check it out, but it might be relevant to update what we do under the hood.

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

3 participants