appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
541 stars 127 forks source link

Support for web-push #28

Closed perrin4869 closed 6 years ago

perrin4869 commented 7 years ago

Are there plans to support web-push? Thanks!

appfeel commented 7 years ago

Not for the moment, but any pull request is welcome :)

perrin4869 commented 7 years ago

I'm not an expect on web-push save for basic usage, but I guess I can try to put down a basic PR together when I get some time

appfeel commented 7 years ago

That will be really great! I think that the first goal would be to have very basic ussage, compatible with the rest of the plugin. The goal of this plugin is to create the notification once and this can be usable by every notification system. So maybe the steps would be:

    {
        method: 'gcm', // The method used send notifications and which this info is related to
        multicastId: [], // (only Android) Array with unique ID (number) identifying the multicast message, one identifier for each chunk of 1.000 notifications)
        success: 0, // Number of notifications that have been successfully sent. It does not mean that the notification has been deliveried.
        failure: 0, // Number of notifications that have been failed to be send.
        message: [{
            messageId: '', // (only for android) String specifying a unique ID for each successfully processed message or undefined if error
            regId: value, // The registrationId (device token id)
            error: new Error('unknown'), // If any, there will be an Error object here
        }],
    },

Please let me know :)

alex-friedl commented 6 years ago

@perrin4869: Quick update from my side: I am currently working on web-push support and hope to have a working solution soon.

alex-friedl commented 6 years ago

Web-Push support added in v1.1.0

jaulz commented 6 years ago

@alex-friedl how does it work for you? I faced some issues because the web-push library expects a string or a Buffer instead of an object. Could you please my PR https://github.com/appfeel/node-pushnotifications/pull/95 which should fix that issue? Thanks!

alex-friedl commented 6 years ago

@jaulz I never passed an object, only strings. Thanks for your pull-request, I will look into it later on. We should probably also update the README?

jaulz commented 6 years ago

@alex-friedl in fact the README already states it: "Data can also be a simple string payload.". My use case is that I want to send the same push notification to all endpoints, hence I need to pass objects.