web-push-libs / web-push

Web Push library for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

util.inherits is not a function

11003 opened this issue · comments

NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This
helps with diagnosing problems quicker.

Setup

Please provide the following details, the more info you can provide the
better.

Operating System:
Node Version: <v20.13.1>
web-push Version: <^3.6.7>

Please select any browsers that you are experiencing problems with:

  • [ - ] Chrome
  • [ - ] Firefox
  • [ - ] Opera for Android
  • Samsung Internet Browser
  • Other
async function onNotify1() {
	// VAPID keys should be generated only once.
	const webPush = await import('web-push')
	webPush.setGCMAPIKey('AIzaSyDNlm9R_w_0FDGjSM1fzyx5I5JnJBXACqU')
	// This is the same output of calling JSON.stringify on a PushSubscription
	const pushSubscription = {
		endpoint: '.....',
		keys: {
			auth: '.....',
			p256dh: '.....'
		}
	}

	webpush.sendNotification(pushSubscription, 'Your Push Payload Text')
}

image