FireForNet.Firebase.Messaging.Blazor 1.0.1-preview.22

Prefix Reserved
This is a prerelease version of FireForNet.Firebase.Messaging.Blazor.
dotnet add package FireForNet.Firebase.Messaging.Blazor --version 1.0.1-preview.22
                    
NuGet\Install-Package FireForNet.Firebase.Messaging.Blazor -Version 1.0.1-preview.22
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FireForNet.Firebase.Messaging.Blazor" Version="1.0.1-preview.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FireForNet.Firebase.Messaging.Blazor" Version="1.0.1-preview.22" />
                    
Directory.Packages.props
<PackageReference Include="FireForNet.Firebase.Messaging.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FireForNet.Firebase.Messaging.Blazor --version 1.0.1-preview.22
                    
#r "nuget: FireForNet.Firebase.Messaging.Blazor, 1.0.1-preview.22"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FireForNet.Firebase.Messaging.Blazor@1.0.1-preview.22
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FireForNet.Firebase.Messaging.Blazor&version=1.0.1-preview.22&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FireForNet.Firebase.Messaging.Blazor&version=1.0.1-preview.22&prerelease
                    
Install as a Cake Tool

FireForNet.Firebase.Messaging.Blazor

Blazor integration for FireForNet Firebase Cloud Messaging.

About FireForNet

FireForNet is a platform-agnostic, .NET-native Firebase Client SDK developed as part of the Circuids ecosystem. It provides a consistent Firebase client development experience across .NET application environments, while allowing platform-specific implementations where Firebase requires them.

About This Package

This package provides IJSRuntime-based Firebase Cloud Messaging implementations for Blazor, working across all Blazor hosting models: WebAssembly, Server, Hybrid (MAUI/WPF/WinForms), and Auto.

It ships a config-free service worker relay (fireForNet-messaging-sw.js). It does not embed Firebase configuration or construct FCM tokens; the .NET layer owns the FCM protocol.

Package Boundary

This package uses IJSRuntime for all JavaScript interop and is the correct choice for any Blazor hosting model.

For framework-independent WASM environments (Uno Platform, Avalonia WASM, pure .NET WASM), use FireForNet.Firebase.Messaging.Browser instead — it uses [JSImport] for direct WASM-to-JS interop without a Blazor dependency.

Installation

dotnet add package FireForNet.Firebase.Messaging.Blazor

Targets net10.0. References FireForNet.Firebase.Messaging transitively.

Usage

services.AddFirebaseMessaging()
        .UseBlazor(options =>
        {
            options.VapidKey = "your-vapid-public-key";
        });

Service Worker

The service worker is registered at ServiceWorkerPath (default /firebase-messaging-sw.js). Your app must serve the shipped module at that stable path.

AutoRegisterServiceWorker defaults to true, so the package registers its service worker automatically during readiness — the zero-config path.

If your app is a PWA that already registers its own service worker at the same scope, a browser allows only one service worker per scope, so the two registrations would replace each other. Instead, compose the relay into your existing service worker and disable auto-registration:

// In your existing service-worker.js, at the top:
importScripts('/_content/FireForNet.Firebase.Messaging.Blazor/fireForNet-messaging-sw.js');
services.AddFirebaseMessaging()
        .UseBlazor(options =>
        {
            options.VapidKey = "your-vapid-public-key";
            options.AutoRegisterServiceWorker = false; // you own the service worker
        });

importScripts attaches the relay's push, notificationclick, pushsubscriptionchange, and message handlers to your worker alongside your own handlers.

Notification Icon

The service worker renders background notifications via showNotification, which requires icon/image/badge to be absolute URLs. The service worker resolves relative values to absolute URLs against the app origin automatically. To give notifications a default app icon when the payload supplies none, set DefaultNotificationIcon:

options.DefaultNotificationIcon = "/icon-192.png";

Options

Option Default Description
ServiceWorkerPath /firebase-messaging-sw.js Path to register the service worker
ServiceWorkerScope / Registration scope
AutoRegisterServiceWorker true Whether readiness registers the service worker
VapidKey official SDK default Web Push VAPID public key
DefaultNotificationIcon null Default notification icon path (resolved to an absolute URL by the service worker)

When the sender supplies a same-origin link (webpush.fcmOptions.link), the service worker opens the app at that URL (cold start) or focuses the existing window, then relays the click to the page (OnNotificationOpened / GetInitialMessageAsync). The received RemoteMessage exposes the target as Notification.Link / Link. Without a link the click is still relayed so the app can route itself. Console-sent notifications fall back to the app origin, mirroring the official Web JS SDK.

Platform / Framework Support

Platform / Framework Status
Blazor WebAssembly Preview
Blazor Server Preview
Blazor Hybrid (MAUI/WPF/WinForms) Preview
Blazor Auto Preview

Documentation

Comprehensive FireForNet documentation is being prepared for the Release Candidate stage.

Project Status

FireForNet is currently available as a Preview release and is approaching its Release Candidate milestone. APIs, package structure, and implementation details may continue to evolve before RC and GA.

The RC milestone will be followed by an extensive cross-platform validation and testing phase before the first GA release.

All FireForNet packages are part of a coordinated release train and share the same version number.

Source Availability

FireForNet is currently being developed in a private source repository during the Preview development phase. The source will be made publicly available as the project approaches its open-source phase, with the public repository established from the appropriate release milestone.

Until then, NuGet Preview packages provide the public distribution channel for evaluating and using FireForNet.

License

This package is licensed under the Apache-2.0 license.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1-preview.22 50 9/27/2026
1.0.1-preview.21 60 9/22/2026
1.0.1-preview.20 56 9/18/2026
1.0.1-preview.19 67 9/12/2026
1.0.1-preview.18 88 8/24/2026
1.0.1-preview.17 86 8/9/2026
1.0.1-preview.16 71 8/9/2026
1.0.1-preview.15 80 8/8/2026
1.0.1-preview.14 75 8/8/2026

v1.0.1-preview.22
- Web registration omits applicationPubKey when unset (declared per property on the request DTO); null values are otherwise written by default (STJ default shape).

v1.0.1-preview.21
- No functional changes; synchronized with the framework-free MAUI integration sweep.

v1.0.1-preview.20
- Synchronized package version with the preview.20 release.

v1.0.1-preview.19
- Synchronized package version with the preview.19 release.
- Fixed tapping a background notification with a link when the app was not open (cold start). The service worker now persists the click payload in IndexedDB — surviving service-worker termination while a slow Blazor boot completes — and delivers it when the freshly opened page signals its relay listener is ready, instead of posting into the void after a fixed 3-second wait. Held payloads expire after 5 minutes.
- The service worker's notification-click link resolution now falls back to the app origin for Firebase Console notifications (google.c.a.c_id data key), matching the official Web JS SDK.
- The payload mapper now surfaces the notification deep link (RemoteNotification.Link / RemoteMessage.Link).

v1.0.1-preview.18
- Synchronized package version with the preview.18 release.

v1.0.1-preview.17
- Fixed FCM registration failing with HTTP 401 UNAUTHENTICATED. The x-goog-firebase-installations-auth header now uses the official `FIS {token}` scheme (matching the Web JS SDK) instead of `FIS_v2 {token}`. The service worker's cold-start re-registration was updated to match.
- Added a configurable default notification icon. The service worker now resolves relative notification icon/image/badge values to absolute URLs against the app origin, and the new MessagingBlazorOptions.DefaultNotificationIcon is provisioned to the worker as the fallback icon when the payload supplies none.

v1.0.1-preview.16
- Fixed RegisterAsync throwing ArgumentNullException when called without RegisterOptions. Registration with a null options now uses the configured MessagingBlazorOptions.VapidKey as documented (null = defaults), instead of crashing. Added regression tests covering the null-options and explicit-VAPID-key paths.

v1.0.1-preview.15
- Fixed ServiceWorkerPath and ServiceWorkerScope being ignored. The page JS module now accepts (path, scope), and the interop/lifecycle coordinator forward the configured values to navigator.serviceWorker.register. Consuming apps can now point registration at the package's shipped service worker (e.g. /_content/FireForNet.Firebase.Messaging.Blazor/fireForNet-messaging-sw.js) without vendoring a copy into their own wwwroot.

v1.0.1-preview.14
- Initial Blazor Firebase Messaging integration: FID-based registration, foreground/notification event relay, permission management, config-free service worker, capability detection.
- Uses IFirebaseInstallations directly for the FIS auth token and persistent FID.