Giter Club home page Giter Club logo

Comments (6)

miqmago avatar miqmago commented on May 30, 2024

Please, could you verify if it works now?

from node-pushnotifications.

zelin avatar zelin commented on May 30, 2024

Yes GCM is now working fine, however the apn is giving error.
I have seen ur test file and i am sending this

const data = {
                        title: title,
                        body : message,
                        alert: message
                    };

However its crashing at

TypeError: Cannot set property 'aps' of undefined
11|city    |     at Object.Notification.toJSON (/var/www/html/test/node_modules/apn/lib/notification/index.js:105:19)
11|city    |     at Object.stringify (native)

from node-pushnotifications.

miqmago avatar miqmago commented on May 30, 2024

Please, could you try with this data?

                  const data = {
                        title: title,
                        body : message,
                        alert: message,
                        custom: {},
                  };

If this works will fix, otherwise will need some work to find the bug.

from node-pushnotifications.

miqmago avatar miqmago commented on May 30, 2024

Also, with this data object, message will be used as alert and title will be ignored in ios. You have two options:

const data = {
    title: title,
    body : message,
    custom: {},
};

or

const data = {
    title: title,
    body : message,
    alert: {
        title: title,
        body : message,
    },
    custom: {},
};

from node-pushnotifications.

zelin avatar zelin commented on May 30, 2024

With both data types i am getting this,
Error: MissingTopic
11|city | at /var/www/html/test/node_modules/node-pushnotifications/lib/sendAPN.js:62:28

from node-pushnotifications.

miqmago avatar miqmago commented on May 30, 2024

I'm not sure if this will fix the problem, please, could you try it now? The problem I think it was related to default parameters.

Right now it should work with this data object:

const data = {
    title: title,
    body : message,
};

If this does not work, it means that topic is mandatory. I will update the docs then (you should include topic field in data).

from node-pushnotifications.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.