Comments (5)
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.
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.
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.
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.
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)
- Force the FCM connection via a proxy?
- How to add an image on notification HOT 1
- TypeError: Cannot read property 'fcm' of undefined (MAC OS system)
- How to display icon HOT 1
- PUSH_RECEIVER:::Error while starting the service TypeError: Object has been destroyed HOT 1
- A javascript error occurred in the main process
- Getting a token, but not receiving any messages, please help! HOT 1
- trouble with ElectronForge webpack plugin HOT 1
- The service is currently unavailable HOT 20
- Is local time used for connecting to FCM server?
- Cannot read property 'fcm' of null HOT 1
- Exception from outdated electron-config module on newer version of Electron HOT 5
- macOS > Not work
- Cannot find module "electron-push-receiver"
- Hello MatthieuLemoine
- Suddenly not receiving notifications anymore. HOT 2
- persistentIds grows without bound? HOT 2
- Is it possible to receive notifications using port 443? HOT 1
- cannot generate a FCM token using electron-push-receiver
- Deleting current token
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-push-receiver.