ASP.NET Core web notification implementation

Enrico Rossini 176 Reputation points

For the intranet company, I want to send to user web notification. This notification could be general (new feature in the intranet) or for a specific user (a task is ready to pick up or an import is completed).

I started to use SignalR but the user receives the notification only if the intranet is open. So, I'm looking around to implement a different web notification and I saw some posts:

I can't find an end-to-end implementation in ASP.NET Core. On GitHub I found a few projects but again when I close the browser, I can't receive the notification.

I can't find any Microsoft documentation for that. What I understood is that I have to create the following parts:

  • Setting up a minimal PWA
  • Subscribe to Push Notifications
  • Send Push Notifications
  • Receive Push Notifications
  • Show Push Notifications

I can't find any end-to-end example for that. Can you point me in the right direction please?

A set of technologies in the .NET Framework for building web applications and XML web services.
4,117 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,160 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce ( 54,621 Reputation points

    Web notifications are typically implemented as a service worker, not a PWA. The api allows a the browser JavaScript to add a notification. Typically the JavaScript polls for the notice, and can only receive the notice if it is running. Thus the use of the service worker.

    You are probably thinking of the o/s notifications, that don’t require a browser. While first available for mobile o/s most desks support now. There is a different api for each platform you want to notify. So typically you use a cloud provider which has support for all platforms and acts as a gateway. See azure communication service as an example

  2. Bruce ( 54,621 Reputation points

    your question is not clear.

    a browser service worker can receive messages while the browser is running, but can not display them. you need a browser app/page running to display the message.

    mobile notifications services work without a browser, but are registered via browser or mobile applications. for mobile platform you want to support, you register your notification application then write web notification service application for each platform using that platforms api. apple desktops also support mobile alerts.

    to simplify to one api, azure, was and other supply a common ap. you still need to register with the individual platform, but you need to write only write one notification service.

  3. Rijwan Ansari 746 Reputation points MVP


    For your case, it is better to have a client application for each platform (mobile, desktop), then you can do push notifications. You can give try with .NET MAUI for client apps with push notifications.

    0 comments No comments