Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PWA widgets] Add documentation about options to update widgets more than once a day #3018

Open
davesmits opened this issue Jan 15, 2024 · 7 comments
Labels
ADO cat: pwas Progressive Web Apps-related content

Comments

@davesmits
Copy link

davesmits commented Jan 15, 2024

There are no noted restrictions about the update time. It kinda suggest the update time can be anything but everything below the values used in the doc (86.400) wont work


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

AB#48547685

@captainbrosset captainbrosset changed the title Add warning about the update time [PWA widgets] Add warning about the update time Jan 15, 2024
@captainbrosset captainbrosset added cat: pwas Progressive Web Apps-related content and removed triage-needed labels Jan 15, 2024
@captainbrosset
Copy link
Contributor

Thanks a lot for this issue.
Can you say a little more about what happens when you choose a value that's less than 86400? What doesn't work exactly? Does the widget not get registered? Something else?

@davesmits
Copy link
Author

@captainbrosset the docs inspired me to built a widget with PWA that shows your agenda from multiple accounts. The ease of using web technolgy and still be able to have full functionality was attractive.

Now I built the widget I learned service workers come with many limitations. The number of invocation of your serviceworker depend on the use of your app but will never be less then once a day (86400); using a update value like 3600 (every hour) will be still once a day, in best case, as many depends on your side engagement score which can be see here in edge: about://site-engagement/

Personally I think if your widget is depended on this, PWA doesnt make sense, Your widget needs to be useful (https://learn.microsoft.com/en-us/windows/apps/design/widgets/) and showing information that is 24 hours makes it useles for many cases

@captainbrosset
Copy link
Contributor

Fair point. I'm going to discuss about this with the engineering team who knows best about service workers and widgets and we'll get back to you.

@captainbrosset
Copy link
Contributor

Here are two options to update your widget:

  • Send Push messages from your server to your service worker, to "wake it up", and use this update your widget.
  • Use widget events like widgetclick and widgetresume. For widgetclick, this would require the user to click on a refresh button in the widget. For widgetresume, I'm not entirely sure when the Windows Widgets board resumes widgets, but it might be worth a shot. I'll try to find out more.

Do these help?

@davesmits
Copy link
Author

I am going to search about widgetresume. Thanks for the pointer!

Send push notifications isn't a option, well gives another challenge. Push Notification are required to use showNotification resuling in a toast banner. I see instagram doing it; but its annoying as hell. (https://web.dev/articles/push-notifications-handling-messages ) ; I am not reallt able to find any docs about edge specifics. So maybe edge is handling this different?

Alternative i was checking was to use WinAppSdk for a full native app and use WinRT background tasks which allows me to update each 15 minutes
(https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.background.timetrigger.freshnesstime?view=winrt-22621)

But given de effort i Did moving to native is bit waste of time

@davesmits
Copy link
Author

davesmits commented Jan 17, 2024

widget resume seems to work pretty nicely. Thanks!

@captainbrosset
Copy link
Contributor

Push Notification are required to use showNotification resuling in a toast banner

Correct, silent push notifications are currently not supported by browsers, at least by Chrome and Edge.

widget resume seems to work pretty nicely. Thanks!

Oh great! Glad this is working for you. I'll add this issue to our backlog and use it to update the docs to mention how to update widgets more than once a day.

@captainbrosset captainbrosset changed the title [PWA widgets] Add warning about the update time [PWA widgets] Add documentation about options to update widgets more than once a day Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO cat: pwas Progressive Web Apps-related content
Projects
None yet
Development

No branches or pull requests

2 participants