Bit.Bcrdt.Butil 11.0.0-pre-18

This is a prerelease version of Bit.Bcrdt.Butil.
dotnet add package Bit.Bcrdt.Butil --version 11.0.0-pre-18
                    
NuGet\Install-Package Bit.Bcrdt.Butil -Version 11.0.0-pre-18
                    
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="Bit.Bcrdt.Butil" Version="11.0.0-pre-18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bit.Bcrdt.Butil" Version="11.0.0-pre-18" />
                    
Directory.Packages.props
<PackageReference Include="Bit.Bcrdt.Butil" />
                    
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 Bit.Bcrdt.Butil --version 11.0.0-pre-18
                    
#r "nuget: Bit.Bcrdt.Butil, 11.0.0-pre-18"
                    
#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 Bit.Bcrdt.Butil@11.0.0-pre-18
                    
#: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=Bit.Bcrdt.Butil&version=11.0.0-pre-18&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bit.Bcrdt.Butil&version=11.0.0-pre-18&prerelease
                    
Install as a Cake Tool

Bit.Bcrdt.Butil

Browser lifecycle integration for bit Bcrdt in Blazor WebAssembly, through bit Butil. The browser knows things a .NET process in a tab cannot see for itself - that the network is back, that the page is going away - and this package acts on them for every open document:

The browser reports What happens
online; the page visible again; a frozen page resumed Documents waiting out a reconnection backoff reconnect at once, instead of up to 30 seconds later.
offline IsOnline turns false and OnlineChanged fires - the moment to tell the user their edits are kept for later.
The page hidden, unloaded or frozen Every open document's changes are waited for until they reach its store, then AfterFlush runs.
pagehide / pageshow Presence is withdrawn while the page is unloaded or in the back/forward cache, and restored when it is shown, so a closed tab leaves the participant list straight away rather than after the presence timeout.
Start-up, if asked navigator.storage.persist(), so the browser does not evict documents kept for offline use.
dotnet add package Bit.Bcrdt.Butil
dotnet add package Bit.Butil          # referenced directly, so its script and build logic reach the app
using Bit.Bcrdt.Butil;

builder.Services.AddBitBcrdtServices(collaboration => collaboration
    .UseTransport(new BcrdtSignalRTransportFactory(hubUrl))
    .UseIndexedDbStore()
    .UseBrowserLifecycle(options => options.RequestPersistentStorage = true));

WebAssemblyHost host = builder.Build();
await host.Services.GetRequiredService<BcrdtBrowserLifecycle>().StartAsync();
await host.RunAsync();

Bit.Butil reaches the browser through its script, so the host page needs _content/Bit.Butil/bit-butil.js before the Blazor script, or Butil's lazy scripts - see the Butil README.

Where it runs

In the browser only. Everywhere else - prerendering, Blazor Server, Blazor Hybrid, a test host - StartAsync does nothing, so the registration can stay in a project that is also prerendered or hosted on the server. In those hosts the documents, their connections and their stores live in a .NET process that a tab going offline or out of sight does not touch; for presence in Blazor Server, AddBitBcrdtCircuitPresence from Bit.Bcrdt.Server does the equivalent job.

Settings

  • ReconnectWhenOnline (on) - only a document in Reconnecting is touched: never one the application disconnected on purpose, nor one that was refused. A fresh attempt that fails leaves the provider's own schedule in charge.
  • FlushWhenHidden (on) and AfterFlush - bit Bcrdt writes changes in the background as they happen, so the flush waits for writes rather than starting them; AfterFlush is where a store whose writes are buffered is made durable, such as a BcrdtBlazeDbDocumentStore with WaitForDurability off: options.AfterFlush = ct => database.FlushAsync(ct). Failures are reported through BcrdtBrowserLifecycle.Error.
  • SuspendPresenceOnPageHide (on) - the withdrawal is sent while the page is torn down, so it reaches the others when the browser still lets the connection send; the presence timeout covers the rest.
  • RequestPersistentStorage (off) - some browsers ask the user, so it is the application's call; IsStoragePersistent says what the browser answered.

Why there is no OPFS store here

Bit.Butil can reach the origin private file system, but a bit Bcrdt store on top of it would rebuild what already ships: Bit.Bcrdt.BlazeDb keeps documents on OPFS through BlazeDb's own backend, with its write-ahead log, torn-tail recovery and Web Locks writer election, and Bit.Bcrdt's BcrdtIndexedDbDocumentStore already lets several tabs persist the same document - which OPFS, whose files take one writer at a time, would make harder rather than easier.

The full guide is in the Bcrdt README.

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.  net11.0 is compatible. 
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
11.0.0-pre-18 0 11/12/2026