diff --git a/README.md b/README.md index 72d06f0..09e2ae1 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,27 @@ builder.Services.AddBlazoredLocalStorageAsSingleton(); This method will not work with Blazor Server applications as Blazor's JS interop services are registered as Scoped and cannot be injected into Singletons. +### Using JS Interop Streaming +When using interactive components in server-side apps JS Interop calls are limited to the configured SignalR message size (default: 32KB). +Therefore when attempting to store or retrieve an object larger than this in LocalStorage the call will fail with a SignalR exception. + +The following streaming implementation can be used to remove this limit (you will still be limited by the browser). + +Register the streaming local storage service + +```c# +public void ConfigureServices(IServiceCollection services) +{ + services.AddBlazoredLocalStorageStreaming(); +} +``` + +Add the JavaScript file to your _App.razor_ + +```html + +``` + ## Usage (Blazor WebAssembly) To use Blazored.LocalStorage in Blazor WebAssembly, inject the `ILocalStorageService` per the example below. diff --git a/samples/InteractiveServer/Components/App.razor b/samples/InteractiveServer/Components/App.razor index b3d68bf..5dd6ff4 100644 --- a/samples/InteractiveServer/Components/App.razor +++ b/samples/InteractiveServer/Components/App.razor @@ -15,6 +15,7 @@