HTTP Transfers
Getting Started
Section titled “Getting Started”Shiny HTTP Transfers enables background uploads and downloads that continue even when your app is suspended. On iOS/Android, transfers are managed by the OS and will resume after app restarts. On Windows, Linux, macOS, and plain .NET hosts a managed HttpClient loop drives transfers and supports resumable downloads via HTTP Range requests. On Blazor WebAssembly, transfers are queued to IndexedDB and drained by a Service Worker via the Background Sync API.
Features
Section titled “Features”- Background uploads and downloads
- Multipart and raw upload support
- Progress tracking with speed and ETA
- Automatic resume after app restart
- Resumable downloads on plain .NET (Linux/macOS/Windows) via HTTP Range requests
- Metered/unmetered network control
- Managed transfer list for UI binding
- Cross-platform: iOS, Android, Windows, Linux, macOS, Blazor WebAssembly
Platform Notes
Section titled “Platform Notes”| Platform | Package | Backing |
|---|---|---|
| iOS | Shiny.Net.Http | NSURLSession background session |
| Android | Shiny.Net.Http | Foreground service + WorkManager |
| Windows | Shiny.Net.Http | Managed HttpClient loop |
| Linux / macOS / Plain .NET | Shiny.Net.Http | Managed HttpClient + IConnectivity loop; resumable downloads via HTTP Range |
| Blazor WebAssembly | Shiny.Net.Http.Blazor | Service Worker Background Sync + IndexedDB; downloads not resumable |
Background Delegate
Section titled “Background Delegate”Implement IHttpTransferDelegate to handle transfer completion and errors in the background.
public partial class MyTransferDelegate : IHttpTransferDelegate{ readonly ILogger<MyTransferDelegate> logger;
public MyTransferDelegate(ILogger<MyTransferDelegate> logger) { this.logger = logger; }
public Task OnCompleted(HttpTransferRequest request) { this.logger.LogInformation("Transfer completed: {Id}", request.Identifier); return Task.CompletedTask; }
public Task OnError(HttpTransferRequest request, int statusCode, Exception ex) { this.logger.LogError(ex, "Transfer failed: {Id}, Status: {Status}", request.Identifier, statusCode); return Task.CompletedTask; }}Android Foreground Service
Section titled “Android Foreground Service”On Android, background transfers run as a foreground service. Customize the notification:
#if ANDROIDpublic partial class MyTransferDelegate : IAndroidForegroundServiceDelegate{ public void Configure(AndroidX.Core.App.NotificationCompat.Builder builder) { builder .SetContentTitle("My App") .SetContentText("Transferring files...") .SetSmallIcon(Resource.Mipmap.appicon); }}#endifRegistration
Section titled “Registration”// iOS / Android / Windows / Linux / macOS / plain .NETservices.AddHttpTransfers<MyTransferDelegate>();
// Blazor WebAssemblyservices.AddBlazorHttpTransfers<MyTransferDelegate>(opts =>{ // Optional — defaults to the bundled Shiny service worker opts.ServiceWorkerPath = "./_content/Shiny.Net.Http.Blazor/http-transfer-sw.js";});On Blazor, ship the bundled SW at the configured path, or import its handlers from your own service worker:
importScripts('./_content/Shiny.Net.Http.Blazor/http-transfer-sw.js');AI Coding Assistant
Section titled “AI Coding Assistant”Step 1 — Add the marketplace:
claude plugin marketplace add shinyorg/skills Step 2 — Install the plugin:
claude plugin install shiny-client@shiny Coming soon — Copilot plugin install instructions will be added here.