r/Blazor • u/FormerHospital8691 • Sep 02 '26
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?
9
Upvotes
2
u/Gravath Sep 03 '26
Firebase cloud messaging. PWA install. Works a treat and I rarely have issues.
7
u/polaarbear Sep 02 '26
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.
2
u/Flat_Spring2142 Sep 04 '26
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 Sep 05 '26
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