web-push-notifications | Web Push Notifications | Notification library
kandi X-RAY | web-push-notifications Summary
kandi X-RAY | web-push-notifications Summary
Update subscription object in server.js, then run node server.js to send a push notification.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of web-push-notifications
web-push-notifications Key Features
web-push-notifications Examples and Code Snippets
Community Discussions
Trending Discussions on web-push-notifications
QUESTION
I want to implement web push notification in django project where frontend is implemented using react. I was following https://www.digitalocean.com/community/tutorials/how-to-send-web-push-notifications-from-django-applications this documentation but i didn't find the way to get VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY for WEBPUSH_SETTINGS. What is the way to get that?
...ANSWER
Answered 2020-Jul-13 at 09:16The DigitalOcean tutorial that you referred to instructs you to "navigate to the web-push-codelab web application. Here, you’ll be given automatically generated keys. Copy the private and public keys." However, it seems like this web page is no longer available.
Another way to generate a VAPID key pair is to use the web-push reference implementation. First install the web-push npm package using npm install web-push -g
, then run web-push generate-vapid-keys
to get an output like:
QUESTION
I have followed this tutorial: https://dzone.com/articles/how-to-add-real-web-push-notifications-to-your-web to enable push notifications on my rails app. I am using the webpush gem to send the notifications.
So far, all I have managed to do is get the browser to ask for permission to send notifications, and when I try to call the method send_web_push_notification (shown below) line 2 is throwing up an error.
I think it is because I am not saving the user's pushSubscription info to the database, but I don't know how to do this. In the tutorial, there is this line at the end: 'We use a database JSON field called web_push_subscription to save the pushSubscription info on our users.'
Would someone be able to show me how to do this?
Any help would be appreciated. Thanks.
send_web_push_notification method:
...ANSWER
Answered 2020-Jan-09 at 02:43If you look closely codes you will notice that you have to create a Json field in database to save subscription. If there is subscription available than push notification will be sent. Actually there many more scenarios it is not necessary the you want to save one browser for user notification, if you plan multiple browser than you have to create separate table, but if you want to add one browser for push notification, than you can add this information in user table too. Create new migration to update your user table and add following column
QUESTION
I have created a Compute Engine - VM and have several websites installed. Also, I have created Network services - Load balancing - Backend configuration: Created Backend services and join the instance group with the same VM above. - Created Cloud CDN and config SSL certificate also done.
The website is https://united-athle.hk/ The CDN domain is https://cdn.ua.sugarproject.com
When I visit the website, the following CORS issue occurred Access to resource at 'https://cdn.ua.sugarproject.com/wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/manifest.json.php?gcm_sender_id=' from origin 'https://united-athle.hk' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I have read Cross-origin resource sharing (CORS), https://cloud.google.com/storage/docs/cross-origin but not really sure how-to config. My storage is in VM engine.
Does anyone have an idea?
...ANSWER
Answered 2019-May-13 at 21:47One option is to configure the web server software running on your VM to include an Access-Control-Allow-Origin header in its responses. For example, including an Access-Control-Allow-Origin: https://united-athle.hk/
header would allow cross-origin requests from https://united-athle.hk/. https://enable-cors.org/server.html has information on how to do this for a variety of web server software.
Alternatively, you could serve both portions of your website from a single domain name, eliminating the need for cross-origin requests.
QUESTION
I haven't used http-server npm module before!
i was just getting starting with using service worker by creating an example app using this blog as a source
In this the author have used http-server to demonstrate service worker!
From the blog, I copied the code snippet to check if chrome is supported
...ANSWER
Answered 2019-Apr-15 at 23:58Looks like http-server
tells the browser to cache pages for an hour by default:
-c
Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1.
Restart the server with http-server -c-1
, then do a hard refresh in the browser (Ctrl/Cmd+Shift+R in Firefox or Chrome).
QUESTION
I am working on a website, where I want to make a feature of notifications, when a user visits my website, they are asked for notifications permission and when they allow it, they will get notifications from my website, and whatever product I want them to get notified by.
Like for example when I visit some websites, they ask me for notifications permissions and when I allow the, I get notified through notifications then. That's all I want for now.
How can I achieve this functionality, I have follow this tutorial, but still confused how the users who allowed the notifications get detected and how all of them are notified then ?
...ANSWER
Answered 2018-Aug-18 at 00:46Web Push library for node.js is just a sender.
You should obtain a subscription JSON object from the browser using Notification API and Service Worker API and then send it to your server, where put it in the database of your choise.
When you will need broadcast notifications, you can retrieve subscription and use a web-push library (for php is also available :)
Note that is a right flow looks following as: 1) Retrieve subscription from the browser 2) Send and store it on your web-server 3) Create notification prototype (just object) 4) Broadcast notification prototype ID you have created to the users 5) Service Worker receive one and fetch notification prototype from your server by ID 6) Show notification using browser API in service worker
For more see here links
https://developers.google.com/web/fundamentals/codelabs/push-notifications/ https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications/
QUESTION
I moved a website to Https and got a problem with OneSignal push notification. I read the documentation of OneSignal but it doesn't help me. The website based on Wordpress and use OneSignal plugin. I received next error in Google dev tools:
Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The path of the provided scope ('/') is not under the max scope allowed ('/wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.
Does anyone have any ideas what the problem with it?
...ANSWER
Answered 2017-Sep-21 at 08:20I looked to a lot of information and resources and found a problem. I use Incapsula as caching tool. This service blocked "Service-Worker-Allowed" header and that's why I got an error.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install web-push-notifications
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page