Product Search


Github Webpushlibswebpush Web Push Library For Nodejs


Web push requires that push messages triggered from a backend be done via the Web Push Protocol and if you want to send data with your push message, you must also encrypt that data according to the Message Encryption for Web Push spec. This module makes it easy to send messages and will also handle legacy support for browsers relying on GCM for message sending / delivery. Installation is simple, just install via npm. The common use case for this library is an application server using a GCM API key and VAPID keys. You can install web-push globally and use it for sending notifications and / or generating VAPID keys. Note: sendNotification() you don't need to define a payload, and this method will work without a GCM API Key and / or VAPID keys if the push service supports it. The first argument must be an object containing the details for a push subscription. The expected format is the same output as JSON.stringify'ing a PushSubscription in the browser.


The payload is optional, but if set, will be the data sent with a push message. This must be either a string or a node Buffer. Note: In order to encrypt the payload, the pushSubscription must have a keys object with p256dh and auth values. Options is an optional argument that if defined should be an object containing any of the following values defined, although none of them are required. APIKey can be a GCM API key to be used for this request and this request only. This overrides any API key set via setGCMAPIKey(). Details should be an object with subject, publicKey and privateKey values defined. These values should follow the VAPID Spec. On timeout, the request will be destroyed and the promise will be rejected with a meaningful error. It's a common misconception that a socket timeout is the timeout to receive the full response. So if you have a socket timeout of 1 second, and a response comprised of 3 TCP packets, where each response packet takes 0.9 seconds to arrive, for a total response time of 2.7 seconds, then there will be no timeout.


Once a socket 'timeout' triggers the request will be aborted by the library (by default undefined). TTL is a value in seconds that describes how long a push message is retained by the push service (by default, four weeks). Encoding is the type of push encoding to use (e.g. 'aes128gcm', by default, or 'aesgcm'). ’s device power considerations for delivery. Provide one of the following values: very-low, low, normal, or high. To attempt to deliver the notification immediately, specify high. Use a maximum of 32 characters from the URL or filename-safe Base64 characters sets. HttpsProxyAgent's constructor argument that may either be a string URI of the proxy server (eg. HTTPS Agent instance which will be used in the https.request method. If the proxy options defined, agent will be ignored! Note: As of this writing, if a push notification request contains a VAPID subject referencing an https://localhost URI (set either using the options argument or via the global setVapidDetails() method), Safari's push notification endpoint rejects the request with a BadJwtToken error.


A promise that resolves if the notification was sent successfully with details of the request, otherwise it rejects. In both cases, resolving or rejecting, you'll be able to access the following values on the returned object or error. Returns an object with publicKey and privateKey values which are URL Safe Base64 encoded strings. Note: You should create these keys once, store them and use them for all future messages you send. You can use a GCM API Key from the Google Developer Console or the Cloud Messaging tab under a Firebase Project. Globally sets the application's VAPID subject, public key, and private key, to be used in subsequent calls to sendNotification() and generateRequestDetails() that don't specifically override them in their options argument. VAPID server contact information, as either an https: or mailto: URI (as per the VAPID spec). Key: the VAPID public key. Key: the VAPID private key. Encrypts the payload according to the Message Encryption for Web Push standard.


PublicKey: The public key matched the private key used during encryption. A string representing the salt used to encrypt the payload. Text: The encrypted payload as a Buffer. The getVapidHeaders() method will take in the values needed to create an Authorization and Crypto-Key header. URL for your application. Key: the VAPID public key. Key: the VAPID private key. Encoding: the type of content encoding to use (e.g. aesgcm or aes128gcm). PublicKey: The public key matched the private key used during encryption. A string representing the salt used to encrypt the payload. Text: The encrypted payload as a Buffer. Note: When calling generateRequestDetails() the payload argument does not need to be defined, passing in null will return no body and exclude any unnecessary headers. Headers related to the GCM API Key and / or VAPID keys will be included if supplied and required. The first argument must be an object containing the details for a push subscription.



Featured Products






Articles


Dugouts And Bats
Get Pictures On Your Ipod
5 Top Features Of Real Diamonds
Spaghetti Squash Pork Stir Fry
Picking An Appropriate Spray Bark Collar On Your Dog
Successful Ways and Methods of Grounding Yourself
Diabetes And Foot Problems
Copper Kitchen Cookware And Kitchen Set At Affordable Prices
How Can You Recognize These Organizations
The Appeal Of Wall Art
Women S Pants Mom S Flare More
Cake Pans Bake The Cakes At Ease With Pans
Beginners Chess Techniques How To Get Strong At Chess Fast
What Is The Best Way To Clean A Catalytic Converter
Buying A Home From A Builder
Toddler Desk And Chairs An Ideal Addition To Your Play Place
Buy Appliances You Choose Installments Installment Gome Electrical Appliances Tv Network Appl
Wireless Surround Sound Headphones Appreciate Listening On Its Ideal
Whether It S A Small Vegetable Patch
Modern Improvements In Golf Clubs
Medical Careers Are Highly Favored In 212
Good Plus Size Lingerie For Your Wardrobe
All The Most Popular Vintage Shoe Styles You Can Get Online Or Offline
Do You Still Use Old Punch Clocks Time To Move On To Time Attendance Software
Php Hypertext Preprocessor
Stay Home Stay Smart Lose Weight With Healthy Food
Winter Gloves For Men Women Kids
Durham Dentist With How to Take Care of Your Dentures Properly
Top 15 Facts About Aliexpress Clone Script 2023
H H As Well As H
The Unquestionable Name of GMC Trucks
Ford Trucks Boosts The Pickup Trucks Segment
Different Kind Of Swimming Pools On Different Surfaces
How To Wear Leggings At Any Age
How To Choose The Best Fitness Equipment
Some Points You Should Consider Before Buying Golf Clubs
Cookies Help Make Ientry Better
How To Avoid The Dangers Associated With Using A Lawnmower
??senior Leadership? Includes The University??s President
How To Select A Good Perfume
How To Attain Best Website Development
How to Choose the Best Electric Shaver for you Personally
Demand Of Second Hand Pulsar Bikes
Reusable Bags The Next Huge Thing Within The Fashion Business
Getting to Know The Best Online Deals For Electronics
How E Mail Marketing Helps Auto Dealerships
How To Teach Cooking To The Children
Uses And Applications Of Distribution Transformers
Tips On Self Installing A Backup Camera System
Finding The Ideal Vehicle Graphics Wraps Provider For Your Business