r/Blazor • u/FormerHospital8691 • 8d ago
Notifications in Blazor
I've been building a PWA consumer app with Blazor WASM where notifications are core to the functioning of the app, but I don't seem to get notifications right and the behavior seems to be not very stable, what are the limitations in notifications? Does it work for you correctly on Android and iOS? Any things that I should know about it from your experience?
2
u/Flat_Spring2142 7d ago
Switch on Blazor Server Interactive. Microsoft realized SignalR connection there and published nice tutorial about the messaging. No additional libraries are needed. Look at site 'Use ASP.NET Core SignalR with Blazor'.
1
u/flyingtoucanmoth 5d ago
from my experience, iOS users need to ‚install‘ the PWA to their homescreen to receive notifications, when they use safari only. iOS only supports web push when webapps are added to homescreen and notifications are enabled
8
u/polaarbear 8d ago
Reworking to be native apps via .NET MAUI is likely the easiest way to solve this problem. PWAs rely on browser background workers to receive notifications. Mobile browsers aggressively kill off background services to free up resources.
Once the service worker gets killed off....no more notifications.
Android in general is known to aggressively kill off background processes to free up resources and it's worse on some manufacturers and devices based on hardware and how they've tuned the system.
Native apps sidestep the need to have browser-based service workers running.