0

I am implementing the Push notifaication in my application with the help of Article = https://medium.com/@arjenbrandenburgh/angulars-pwa-swpush-and-swupdate-15a7e5c154ac

I am using Angular version7 and using => SwPush from '@angular/service-worker' for push notification in my App.

To run the application and see push notification functionality in my app, I use 2 commands:

  1. ng build --prod
  2. http-server -p4100 -c-1 dist/my-pwa-app

After running these 2 commands, the app shows: enter image description here

when i open http://localhost:4100 OR http://127.0.0.1:4100 the service worker is running and push notification is working.

But when i open http://172.16.0.201:4100 in the browser, there is no service worker running in the Application => Service worker

1

1 Answer 1

4

This is because Service Workers are restricted to HTTPS connections with excemptions for localhost and 127.0.0.1. In order to have SW working in 172.16.0.201 (or anything else than the localhost), you need to serve the page over HTTPS connection.

More information available here https://stackoverflow.com/a/34161385/5038943

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.