Code Monkey home page Code Monkey logo

Comments (5)

MatthieuLemoine avatar MatthieuLemoine commented on June 7, 2024

Electron doesn't implement the PushManager API so you can't use a serviceWorker registration to receive push notifications. It's the reason why I created push-receiver in the first place.

Using electron-push-receiver, you'll receive a TOKEN_UPDATED event with the token you can use to send a push notification. To setup this library, you just need to follow the README.

from electron-push-receiver.

riatzukiza avatar riatzukiza commented on June 7, 2024

I understand that, I don't want the service worker. I want to get the endpoint url with out invoking all that browser stuff. is there a way to generate it from the token?

from electron-push-receiver.

MatthieuLemoine avatar MatthieuLemoine commented on June 7, 2024

The endpoint to use to send notifications is the FCM one. You can find an example here https://github.com/MatthieuLemoine/push-receiver/blob/master/scripts/send/index.js#L21

from electron-push-receiver.

riatzukiza avatar riatzukiza commented on June 7, 2024

I saw that, the issue I'm having is I'm working on an electron client to a backend I don't have much control over, and they are sending the exact url that the browser would usually give them, and doing push notifications with that url. The url the browser gives looks like
https://android.google.com/gcm/send/oig9h238h49fsf7....

The fact that it was gcm that the chromium browser gave back was a little funny to me.

I've been hunting all around to see if I can get a url similar to that, that wouldn't require that back end to be changed.

If I could also know for sure that I couldn't do it with the token I get back from this library, that'd be fine and I just need to wait on the backend to be modified to accept a token.

from electron-push-receiver.

MatthieuLemoine avatar MatthieuLemoine commented on June 7, 2024

I guess you could try https://fcm.googleapis.com/fcm/send/${token}, it's what we use to register to FCM https://github.com/MatthieuLemoine/push-receiver/blob/817c843c0689d0b73b823485012897d7b02a168e/src/fcm/index.js#L20

from electron-push-receiver.

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.