We enter this mode, when user user subscribes and JS detects that client has all the features we want and we successfully get notification permission.
Note: If there are subscribed clients, clients in mode ⓐ and ⓑ may be presented with status occupied, while subscribed clients get pushed about status being free.
After user subscribes
[ ] We stop with the long polling and only wait for pushes, abort any ongoing polls.
[ ] Don’t poll even after reloading the page.
After push is received in Service Worker
[ ] Show notification
[ ] Inform all clients that they should start polling again
static/index.mjs
got fat and hard to follow.Modes of operating
Progressive enhancement FTW.
ⓐ HTML page that refreshes itself with
<meta http-equiv="refresh">
:link:Served by the server.
ⓑ HTTP Long polling :link:
When user subscribes
localtunnel.me
). After some timeout, act same as we’d get denied.When we are not using web push and we see
free
next timeⓒ Push :link:
We enter this mode, when user user subscribes and JS detects that client has all the features we want and we successfully get notification permission.
Note: If there are subscribed clients, clients in mode ⓐ and ⓑ may be presented with status
occupied
, while subscribed clients get pushed about status beingfree
.After user subscribes
After push is received in Service Worker
Client state
free