← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Web Push Notifications

Mobile PHP 7.0+ Advanced
debt(d8/e7/b5/t6)
d8 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'silent in production until users hit it' (d9), slightly better at d8 because Lighthouse PWA audits can flag missing push/service-worker setup, but absence of push as a feature is not caught by linters — it manifests as low re-engagement metrics.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7), because adding web push requires VAPID key generation, service worker registration on the frontend, subscription storage schema in MySQL, a sending pipeline using web-push-php, and permission UX flows — touches frontend, backend, and DB.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5), because subscription lifecycle (410 Gone handling, expiry, unsubscribe), VAPID key management, and notification content workflows impose ongoing maintenance across the notification subsystem, though contained to that component.

t6 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7), per the misconception that web push requires a native app — devs wrongly build email-only or native-only flows when iOS Safari 16.4+ PWAs now support the same PHP backend; also the permission-prompt-on-load mistake is a well-known UX trap.

About DEBT scoring →

Also Known As

push API web notifications VAPID service worker push

TL;DR

Sending notifications to users even when the browser is closed — using the Push API, Service Worker, and Web Push Protocol with VAPID authentication.

Explanation

Web Push uses three components: Push API (browser API to subscribe), Web Push Protocol (RFC 8030 — standardised push delivery), and Service Worker (receives and displays notifications when the browser is closed). Flow: (1) user grants notification permission, (2) browser creates a push subscription (endpoint URL + encryption keys), (3) PHP backend stores the subscription, (4) PHP sends a push message to the subscription's endpoint via web-push library (minishlink/web-push), (5) push service delivers to browser, (6) service worker shows a notification. VAPID (Voluntary Application Server Identification) authenticates your server to the push service.

Common Misconception

Web Push requires a native app — web push works in all modern browsers including iOS Safari 16.4+ PWAs; the same PHP backend serves both web and mobile push notifications.

Why It Matters

Re-engaging users who have closed the browser requires push notifications — without them, the only re-engagement channel is email.

Common Mistakes

  • Requesting notification permission immediately on page load — users deny unsolicited permission requests.
  • Not handling push subscription expiry — subscriptions expire or become invalid; handle 410 Gone responses.
  • No unsubscribe mechanism — users must be able to revoke permission.
  • Sending too many notifications — notification fatigue causes users to revoke permission.

Code Examples

✗ Vulnerable
// Immediate permission request — high denial rate:
document.addEventListener('DOMContentLoaded', () => {
    Notification.requestPermission(); // Before user understands the value
    // 80%+ denial rate for unprompted permission requests
});
✓ Fixed
// Context-triggered permission request:
orderCompleteButton.addEventListener('click', async () => {
    await submitOrder();
    // Now user understands value:
    if (Notification.permission === 'default') {
        const perm = await Notification.requestPermission();
        if (perm === 'granted') await subscribeToNotifications();
    }
});

async function subscribeToNotifications() {
    const sw = await navigator.serviceWorker.ready;
    const sub = await sw.pushManager.subscribe({
        userVisibleOnly: true,
        applicationServerKey: VAPID_PUBLIC_KEY,
    });
    await fetch('/api/push/subscribe', {
        method: 'POST', body: JSON.stringify(sub)
    });
}

Tags


Added 16 Mar 2026
Edited 22 Mar 2026
Views 47
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping T 1 ping W 1 ping T 0 pings F 1 ping S 0 pings S 4 pings M 0 pings T 0 pings W 0 pings T 2 pings F 1 ping S 1 ping S 0 pings M 0 pings T 1 ping W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Amazonbot 8 ChatGPT 6 Perplexity 5 Google 5 Scrapy 4 Ahrefs 3 Unknown AI 2 Claude 2 SEMrush 2 Meta AI 1
crawler 33 crawler_json 5
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: High
⚡ Quick Fix
Use the Push API + Service Worker for web push — generate VAPID keys, store subscriptions in PHP/MySQL, and send via web-push library on the PHP side
📦 Applies To
PHP 7.0+ web laravel
🔗 Prerequisites
🔍 Detection Hints
No web push implementation for notification features; polling for notifications instead of push; PHP only sending email for real-time notifications
Auto-detectable: ✗ No lighthouse web-push-php
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: Medium ✗ Manual fix Fix: Medium Context: File


✓ schema.org compliant