PHP Classes

Client Forcing Update of Subscription

Recommend this page to a friend!

      PHP Web Push Notifications Server  >  PHP Web Push Notifications Server package blog  >  How to Use PHP to Sen...  >  All threads  >  Client Forcing Update of Subscription  >  (Un) Subscribe thread alerts  
Subject:Client Forcing Update of Subscription
Summary:Client Side Update
Author:michael Prosser
Date:2021-10-15 18:43:59

  1. Client Forcing Update of Subscription   Reply   Report abuse  
Picture of michael Prosser michael Prosser - 2021-10-15 18:43:59
Hello and thank you for this incredible class. I had no issues getting your code to work but did find the browser was inconsistent in updating the subscription.

I found that in your example, if after the subscribe and unsubscribe functions are executed you fire the load function again (I delayed it 500ms using a setTimeout) the experience is superb.

<button id="unreg-btn" onclick="pnUnsubscribe(); setTimeout(function(){ Load(); },500);">Unsubscribe</button>

is an example that forces the browser to show you the new status right away (well 500ms later). Not sure how much delay is needed. It may just need a single frame and time can be set to 0 but 500 works well so I kept it that way.

Again, thank you :)

For more information send a message to info at phpclasses dot org.