ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 208 forks source link

Question: Support for Mozilla Push Notifications #205

Closed nevi-me closed 8 years ago

nevi-me commented 8 years ago

Mozilla announced yesterday that FF44+ will now support Push Notifications.

Today I tried to use my current Push Notification implementation, which works on Chrome. I found that it works, except that the endpoint is different. Mozilla uses https://updates.push.services.mozilla.com/push/, which means that we have to post messages to their servers.

My question is whether node-gcm should remain as a GCM only implementation (makes sense because of the name)?

I am still implementing the Mozilla endpoint, and I'll see how they differ. Perhaps the only thing that would need to change would be the GCM_SEND_ENDPOINT and related, which would be great. I'll post an update in a short while after testing. There's npmjs::web-push, which has been used in Mozilla examples on webworke.rs. I saw it using GCM, so perhaps all they did on the examples was change the send endpoint.

nevi-me commented 8 years ago

Web-push does support a custom endpoint: sendNotification(endpoint, TTL, userPublicKey, payload). Only saw that now.

hypesystem commented 8 years ago

If all that needs to change is supporting an optionally different endpoint it is definitely within the scope of this repo! Let us know what you figure out, and please do make a PR if you have the time :-)

Thanks

eladnava commented 8 years ago

@hypesystem Definitely agree, however, wouldn't it be misleading that the module will still be called node-gcm?

nevi-me commented 8 years ago

I think it would. One other thing we'd have to consider would be that Mozilla supports sending encrypted payloads, which would require more than just being able to specify a different endpoint.

hypesystem commented 8 years ago

Ah. Yeah, let's leave it out of this repo then. Check out web-push, which I think does what you're asking for :smile:

If we want to build a single repo with all the functionality it should be a fork with a new name.