Visitar URL original
Push Notifications · YAFNET/YAFNET Wiki · GitHub
Skip to content
Ingo edited this page Nov 2, 2026 · 1 revision

Push notifications

YAF.NET v4 can send browser push notifications for new topics and replies in the forums and topics a user watches. Users get them even when the forum isn't open in a browser tab. The same feature lets users install the forum as an app (Progressive Web App, PWA).

Push notifications use the Web Push standard with VAPID keys. They are turned off until you configure the keys.

Requirements

  • The forum runs on HTTPS. Browsers only allow push notifications on HTTPS sites (and on localhost for testing).
  • A browser that supports Web Push: all current versions of Chrome, Edge, Firefox and Safari (on iOS / iPadOS only after adding the forum to the home screen).

STEP 1. Generate the VAPID keys

Generate a key pair at yetanotherforum.net/Vapid-Keys, or with any other Web Push VAPID key generator, e.g. the web-push npm package:

npx web-push generate-vapid-keys

Important

Keep the private key secret, and don't commit it to a public repository. If you change the keys later, all existing subscriptions stop working and users have to subscribe again.

STEP 2. Add the keys to appsettings.json

"VapidConfiguration": {
  "PublicKey": "<your public key>",
  "PrivateKey": "<your private key>"
}

With Docker:

environment:
  - VapidConfiguration__PublicKey=<your public key>
  - VapidConfiguration__PrivateKey=<your private key>

Restart the forum.

STEP 3. Users subscribe

Each user turns on push notifications for each device and browser under My Account > Notification Preferences > Device (Browser) push notifications. The browser then asks for permission to show notifications.

Guests can't subscribe.

Troubleshooting

  • The option is missing: the keys are empty, or the forum hasn't been restarted after you added them.
  • The browser doesn't ask for permission: the site doesn't run on HTTPS, or notifications for the site were blocked earlier in the browser settings.
  • Notifications stop after a while: the browser or operating system removed the subscription. The user can subscribe again on the same page.

Clone this wiki locally