0

I am trying to implement web push notifications in my project, but none of the approaches I tried are working. I’m not sure whether the issue is on the frontend, backend, service worker, or the push provider configuration.

My Tech Stack

  • Frontend: React + Vite

  • Backend: Spring Boot (Java)

  • Database: MySQL (storing push subscriptions / device tokens)

What I Have Tried

I attempted multiple methods for sending push notifications:

  1. WebSockets – real-time connection works, but notification is not shown in the browser when the tab is closed or inactive.

  2. VAPID + Web Push API– subscribe

  3. AWS SNS (Web Push Platform Application) – device registered, but SNS returns message-delivery failures.

  4. Firebase cloud messaging – FCM token is generated, but no notification is received on the client.

Current Behavior

  • Service Worker registers successfully.

  • Push subscription is created and saved in SQL.

  • IN

    • Either I get a server error (400/500)

    • Or the request is successful but no notification appears in the browser.

What I Need Help With

  1. What is the correct/best way to implement browser push notifications for:

    • React (Vite)

    • Java Spring Boot

    • Service Worker

  2. Is there a working example or common mistakes to check?

  3. Are there required headers, payload formats, or service-worker rules I might be missing?

Extra Notes

  • I’m testing on localhost + production domain (HTTPS).

  • It's going to happen.

  • Subscribe

New contributor
MANOJ V is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.