teleclimber,
@teleclimber@social.tchncs.de avatar

Some talk about here:

https://mastodon.social/@bendelarre/111126758524773053

I have mixed feelings about PWAs. They're the best way to get an app on a user's device right now (no app stores!) but the hoops you have to jump through...

Take the Periodic Background Sync API (https://developer.chrome.com/articles/periodic-background-sync/) which articles will have you believe is a way to keep the data fresh on your app ("fetch latest widgets every hour") as illustrated here:

https://web.dev/app-like-pwas/#background-app-refreshing (by @tomayac)

The problem is...

1/

teleclimber,
@teleclimber@social.tchncs.de avatar

@tomayac I built a app for myself that is just a simple notification thing. It's a list of events that happen on a server I have. There are 0 to <10 of these per day.

I wanted to use periodic background sync to fetch these every 15 or 30 minutes, which you would think I could do.

But I can't.

Why? Because the fetch frequency is modulated by the "site-engagement score" (on at least) https://www.chromium.org/developers/design-documents/site-engagement/

And site engagement is based on...

2/

teleclimber,
@teleclimber@social.tchncs.de avatar

@tomayac Site engagement is based on :

  • time/activity on site (scrolling, clicking)
  • media playback.

Just one problem: I spend no time on this site. It takes 5 seconds to look at the events to my satisfaction. I don't scroll bc latest are at the top. There is nothing to tap.)

Result: my site engagement is 26/100, and consequently my minimal interval allowed by Chrome for a refresh is 24 hours. In other words, completely useless. I manually open and refresh x times per day instead. 😤

3/3

teleclimber,
@teleclimber@social.tchncs.de avatar

@tomayac Addendum: This site says there is a minimum of 12 hours (though they don't provide a reference for that number):

"To prevent websites from abusing this, the frequency of those synchronizations depends on the site-engagement score, which the browser sets for every website. If you open a specific web app a lot, this frequency can go up to a maximum of 12 hours."

https://felixgerschau.com/service-workers-explained-introduction-javascript-api/

In any case, this is what I remember concluding about periodic background sync: it's unusable.

tomayac,
@tomayac@toot.cafe avatar

@teleclimber Feel free to submit a https://new.crbug.com and post the URL here for triaging. The initial idea of the indeed arbitrary limit was to prevent abuse. I agree it makes the API less useful than it could be in theory. Time to visit the limit discussion again maybe.

schizanon, (edited )

@teleclimber I believe that adding a site to your homescreen (installing a PWA) is a strong engagement signal.

Weird that the browser wouldn't do what the API is requesting and you're permitting...

Maybe try configuring the PWA to run at login? https://developer.chrome.com/blog/run-on-login/

teleclimber,
@teleclimber@social.tchncs.de avatar

@schizanon It's already installed on home screen and I interact with it several times a day every day. I still only get 26/100.

I use that app on my Android phone. The article seems to say "start on login" is for desktop OS.

(On Android if I go to about://apps I get redirected to chrome://apps, and that page shows a "This site can't be reached" error, so that's not great.)

schizanon,

@teleclimber check this one out..chrome://site-engagement/

Can you edit your site's "base"?

teleclimber,
@teleclimber@social.tchncs.de avatar

@schizanon Yes I did notice I can manually change the numbers there, and they survive a refresh. I don't know if this has an impact on anything bc of course Chrome doesn't tell you "you're limited to 12 hours because of ...". It's quiet on the server these days so it may take a while for me to find out.

In any case this is such atrocious it doesn't solve the problem for regular users. I can only hope some of this will go away or be improved significantly in time.

schizanon,

@teleclimber well, to be fair, it's good that any website you visit can't just make as many background requests as it wants. That would be bad for people's battery life and data plans.

Speaking of, could your phone be limited by battery saver/data saver settings?

Is there always new data that you app needs to load? Even if the user isn't using the app? Why can't you just load it when the user opens the app, or use webPush to push new data to it instead?

teleclimber,
@teleclimber@social.tchncs.de avatar

@schizanon My phone is fully charged and not on any battery saver mode.

Here is where the 12 hours limit is described: https://github.com/WICG/background-sync/issues/169 along with many other (possibly valid) security issues of background sync.

I just wish there was a way for me to say "I'm OK with this app making these requests every 15 minutes". Maybe instead of watching metrics this could be implemented as a permission:

"SomeApp wants to contact the server at <URL> when the app is not in use. Deny|Allow"

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ethstaker
  • DreamBathrooms
  • cubers
  • osvaldo12
  • mdbf
  • magazineikmin
  • normalnudes
  • InstantRegret
  • rosin
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • ngwrru68w68
  • JUstTest
  • everett
  • cisconetworking
  • tacticalgear
  • anitta
  • thenastyranch
  • Durango
  • tester
  • GTA5RPClips
  • modclub
  • megavids
  • provamag3
  • Leos
  • lostlight
  • All magazines