Files

1.1 KiB

Push Notification Testing — Shark Game

iOS Safari Limitation

PushManager is NOT available in Safari on iPhone when browsing normally. It ONLY works when the page is launched from a Home Screen PWA icon (Add to Home Screen).

Test flow for iOS:

  1. Visit shark.iamgmb.com/push-test.html
  2. Tap Share icon -> Add to Home Screen
  3. Open the test page from the Home Screen icon
  4. Tap Enable Push Notifications — all steps should pass

Standalone Test Page

/push-test.html at /var/www/shark-game/push-test.html shows a full diagnostic log of each push setup step. No login required.

Subscription Endpoint

POST /api/push/subscribe requires JWT auth. POST /api/push/subscribe-noauth stores under user_id=0 (for testing only).

Both expect: {endpoint, p256dh, auth}

Banner Visibility Bug

The pushBanner div starts with style="display:none". The JS function showNotificationBanner() must explicitly set banner.style.display = 'block'. Without this, the banner exists in the DOM but is never visible.

VAPID Keys

Generated once, stored in /root/shark-game/backend/server.py as module-level variables. Public key exposed at GET /api/push/vapid-public-key.