webpush | webpush , Encryption Utilities for Web Push protocol | Notification library
kandi X-RAY | webpush Summary
kandi X-RAY | webpush Summary
This gem makes it possible to send push messages to web browsers from Ruby backends using the Web Push Protocol. It supports Message Encryption for Web Push to send messages securely from server to user agent. Payload is supported by Chrome 50+, Firefox 48+, Edge 79+.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encrypts a message using the encrypted key and encryption key
- The HTTP headers .
- raise an error message
- Make a HTTP request .
- Generate the header header
- Get proxy options
- Verify that the parameters are valid
- Builds a message from the payload
- Returns the public key
- Gets the severity
webpush Key Features
webpush Examples and Code Snippets
Community Discussions
Trending Discussions on webpush
QUESTION
I am using push notifications in Django, I am using the library https://github.com/safwanrahman/django-webpush
It work correctly in Chrome and Firefox, but in Safari I have a JS error.
...ANSWER
Answered 2021-May-27 at 09:34That's because for invoking push notification in Safari or IOS devices, APNS (Apple Push Notification Service) is required and maintainers of django-web-push have not integrated them yet.
You will need to add APNS support by yourself by adding a fallback option for IOS devices and browsers or you can use any other apns push notification service.
QUESTION
I have put some push notifications in my code, in order to someone to be notified when an action is made. I made the back end with lib.net.webpush 3.1.0 with .net 4.5.2 in C#. So far, the notification system is working very well, but there is something I can't succeed : Within my service worker file (sw.js), using Angular 9, i want, when someone received the notification, that when a user click on it, he is redirect to the page from which it was sent.
first i made it like it (as i read in the doc):
...ANSWER
Answered 2021-May-17 at 13:02I just succeed in doing it. So, for anyone in the same case as I was : within the service worker, you can't access the DOM, i wasn't able to get any ID or any path I was trying to aim in my code. The solution was to, in my C# code, to add a "URL" property and parameter to my "SendNotification" funtion. Then, when i got a user, i can target his ID because it's already here. Then, in my Angular code (within the service worker file), I just had to to this (i am storing my url in "data" here) :
QUESTION
I'd like to make web push with c#. In the backend I use web-push-csharp. I try to test it with postman before pass the API to frontend developer but I get this error.
"Message": "An error has occurred.", "ExceptionMessage": "The best overloaded method match for 'WebPush.WebPushClient.SendNotificationAsync(WebPush.PushSubscription, string, System.Collections.Generic.Dictionary)' has some invalid arguments", "ExceptionType": "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException",
The error comes from payload in the json body because when I replace it with a simple string , the error is gone.
This is the json body in postman:
...ANSWER
Answered 2021-Apr-02 at 15:03Solved by creating the payload like this :
QUESTION
I've installed django-webpush in my project and put
{% webpush_header %}
in the part of my HTML template as instructed, however I am getting an error:
ANSWER
Answered 2021-Mar-03 at 17:58I assume your urls.py is something like so:
QUESTION
I installed web push :
...ANSWER
Answered 2020-Sep-20 at 14:20I fixed the error by using \
instead of /
QUESTION
Please explain to me how webpush work in TCP/IP network layers (especially layer 4-5).
I understand that HTTP is stateless protocol:
- the protocol is opening TCP / layer 4 connection,
- 'state' is 'made to work' with cookie/session,
- then client send HTTP request (plaintext/compressed "HTTP/1.1 /url/here ... Content-Length: ..."),
- then server respond with HTTP request (plaintext/compressed "200 OK ... ..."),
Therefore it's understandable that for a user behind NAT to be able to view webpage of a remote host (because the user behind NAT is the one initiating the connection); but the webserver cannot initiate TCP connection with the client (browser process).
However there are some exceptions like 'websocket' where client (browser) initiate a connection, then leave it open (elevate to just TCP, not HTTP anymore). In this architecture, webserver may send / initiate sending message to client (for example "you have new chat message" notification).
What I don't understand is the new term 'webpush'.
- I observed that it can send notification from server to client/browser (from user, it 'feels' like the server is the one initiating the connection)
- webpush can send notification anytime, even when browser is closed / not opened yet (as when the device was just freshly turned on), or when it's just connected to internet
How does it work? How do they accomplish this? Previously I think that:
- either a javascript in a page is continously (ex: 5 second interval) checking if there's a new notification in server,
- or a javascript initiate a websocket (browser initiate/open TCP connection) and keep it alive, when server need to send something, it's sent from webserver to client/browser through this connection
Is this correct? Or am I missing something? Since both of my guess above won't work behind NAT'd network
Is Firebase web notification also this kind of webpush?
I have searched the internet for explanation on what make it work on client side, but there seems only explanation on 'how to send webpush', 'how to market your product with webpush', those articles only explain the server side (communication of app server with push service server) or articles about marketing.
Also, I'm interested in understanding what application layer protocol they're running on (as in what text/binary data the client/server send to each other), if it's not HTTP
...ANSWER
Answered 2020-Nov-28 at 14:34Web Push works because there is a persistent connection between the browser (e.g. Chrome) and the browser push service (e.g. FCM).
When your application server needs to send a notification to a browser, it cannot reach the browser directly with a connection, instead it contacts the browser push service (e.g. FCM for Chrome) and then it's the browser push service that delivers the notification to the user browser.
This is possible because the browser constantly tries to keep an open connection with the server (e.g. FCM for Chrome). This means that there isn't any problem for NAT, since it's the clients that starts the connection. Also consider that any TCP connection is bi-directional: so any side of the connection can start sending data at any time. Don't confuse higher level protocols like HTTP with a normal TCP connection.
If you want more details I have written this article that explains in simple words how Web Push works. You can also read the standards: Push API and IETF Web Push in particular.
Note: Firebase (FCM) is two different things, even if that is not clear from the documentation. It is both the browser push service required to deliver notifications to Chrome (like Mozilla autopush for Firefox, Windows Push Notification Services for Edge and Apple Push Notification service for Safari), but it is also a proprietary service with additional features to send notifications to any browser (like Pushpad, Onesignal and many others).
QUESTION
I have node.js with express backend with some endpoints, all works fine testing with curl or postman, but on my client-side with angular on the http.post request i get the response correctly, but no cookie is saved. I've tried changing my localhost dns, after some try i'm ended up using 127.0.0.1:4200 client and 127.0.0.1:3000 backend.
backend code:
...ANSWER
Answered 2020-Nov-14 at 12:24the BENARD Patrick tips was right!!
To solve my problem add withCredentials both on client and server (using this solution I've had to specify the domain)
client code:
QUESTION
I'm trying to run a 'node.js' server for push notification. But I received an error instead. This was picked up on a tutorial for adding push notification using SwPush to PWA on Angular.
Do I need to place the Public key somewhere?? I had generated public and private keys using "web-push generate-vapid-keys".
Server.js script:
...ANSWER
Answered 2020-Sep-24 at 02:47In your line 1:
QUESTION
When a user create a subscription through the PushManager.subscribe(), given the applicationServerKey
(VAPID public key), it creates a valid subscription the contents of which can be sent and stored in the database. The content sent to the database looks something like the following:
ANSWER
Answered 2020-Sep-06 at 21:46You can safely use the endpoint
as a unique identifier in your database and in the frontend calls to the backend.
We have been using it in the Pushpad Javascript SDK since 2015 without any problem.
For example, you can use the endpoint as an identifier when you make a call from Javascript to the backend in order to store data for that specific subscription.
An endpoint can be considered unique and secret (since it contains a long random token).
This is true now and it was also true at the beginning of the standard... in the past the keys
and payload were not even present and the endpoint
alone was used for everything, including fetching the new notifications from the application server.
For the keys
I would simply keep them secret in the database and not use them as identifiers.
QUESTION
I use firebase_messaging
for push notifications and to send the messages I use POST
requests.
When sending messages to FCM token
it all works properly, but when sending them to topic
(I basically modified the request I use for token
messages) they won't get delivered.
I checked and the topic is correct and on physical Android device I'm correctly subscripted to that topic, as when sending a topic message from FCM console it gets delivered immediately. Can you spot what I'm doing wrong here?
Many thanks.
token message (working): ...ANSWER
Answered 2020-Aug-25 at 15:31everything you have done is correct in the topic messaging, but you have to modify your "to"
key to this :
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install webpush
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