/shiny:shiny-http-transfersfrom shiny
Guide for generating code that uses Shiny.NET HTTP Transfers for background uploads and downloads on iOS/Android, Windows, Linux, macOS, and Blazor WASM (Service Worker Background Sync), including transfer progress surfaces - iOS Live Activities and the Android foreground-service notification
Ships in shiny. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Background HTTP upload and download management. On iOS, backed by native NSURLSession background sessions. On Android, Windows, Linux, macOS, and base .NET, backed by an in-process managed loop using HttpClient + IConnectivity that wakes on connectivity changes and supports resumable downloads via HTTP Range requests (uploads always restart); on Android this loop runs inside a foreground service. On Blazor WASM, backed by the Service Worker Background Sync API (IndexedDB queue drained by the SW via fetch() while the tab is closed).
Use this skill when the user needs to:
| Item | Value |
|---|---|
| NuGet | Shiny.Net.Http (one package everywhere - its net10.0 build includes Blazor WASM) |
| Namespace | Shiny.Net.Http |
| Platforms | iOS, tvOS (native NSURLSession); Android, Windows, Linux, macOS, .NET base (managed HttpClient loop); Blazor WASM (Service Worker) |
| DI Setup | services.AddHttpTransfers<TDelegate>() (iOS/tvOS/Android/Windows), services.AddHttpClientTransfers<TDelegate>() (Linux/macOS/plain .NET), or services.AddBlazorHttpTransfers<TDelegate>() (Blazor) |
The registration extension methods live in the Shiny namespace and are available on IServiceCollection.
tvOS uses services.AddHttpTransfers<TDelegate>() and the same background NSUrlSession as iOS, so transfers continue while the app is suspended. Storage is the difference worth calling out: an Apple TV has no user-visible file system and a small, evictable app container — write transfer output to the cache directory and treat a completed download as something the OS may reclaim between launches.
In your MauiProgram.cs:
using Shiny;
builder.Services.AddHttpTransfers<MyHttpTransferDelegate>();
Create a class that implements IHttpTransferDelegate (or inherits from the abstract HttpTransferDelegate base class for built-in retry logic):
using Shiny.Net.Http;
public class MyHttpTransferDelegate : HttpTransferDelegate
{
public MyHttpTransferDelegate(
ILogger<MyHttpTransferDelegate> logger,
IHttpTransferManager manager
) : base(logger, manager, maxErrorRetries: 3) { }
public override Task OnCompleted(HttpTransferRequest request)
{
// Handle successful transfer completion
return Task.CompletedTask;
}
// Optional: override for 401 handling
protected override Task<HttpTransferRequest?> OnAuthorizationFailed(
HttpTransferRequest request, int retries)
{
// Return a new request with refreshed auth headers, or null to cancel
return Task.FromResult<HttpTransferRequest?>(null);
}
}
On Android, the delegate must also implement IAndroidForegroundServiceDelegate:
#if ANDROID
public partial class MyHttpTransferDelegate : IAndroidForegroundServiceDelegate
{
public void Configure(AndroidX.Core.App.NotificationCompat.Builder builder)
{
builder
.SetContentTitle("File Transfer")
.SetContentText("Transferring files in the background");
}
}
#endif
On non-platform .NET hosts (Linux, macOS server, console apps, etc.) call AddHttpClientTransfers<TDelegate>() instead of AddHttpTransfers<TDelegate>(). It registers HttpClientHttpTransferManager backed by an HttpClient loop driven by IConnectivity that wakes immediately on connectivity changes. Downloads resume after network interruption via HTTP Range requests (Range: bytes=N-, FileMode.Append when the server responds with 206 Partial Content); uploads always restart from scratch.
The managed loop resolves its HttpClient from IHttpClientFactory using the named client HttpClientHttpTransferProcess.HttpClientName ("Shiny.Net.Http"). To customize it (timeouts, default headers, a custom primary handler, Polly, etc.), configure that named client after registering transfers: services.AddHttpClient("Shiny.Net.Http").ConfigureHttpClient(c => c.Timeout = TimeSpan.FromMinutes(10));. (iOS/Mac Catalyst use NSUrlSession and ignore this.)
IConnectivity is registered for you (AddConnectivity() from Shiny.Core - register your own first to replace it). A default JSON filesystem repository is registered automatically and persists transfer state to {LocalApplicationData}/Shiny across process restarts.
Cancelled downloads clean up any partial file on disk so a subsequent re-queue starts fresh.
Shiny.Net.Http)using Shiny;
builder.Services.AddBlazorHttpTransfers<MyDelegate>(opts =>
{
opts.ServiceWorkerPath = "./_content/Shiny.Net.Http/http-transfer-sw.js";
});
AddBlazorHttpTransfers ships in Shiny.Net.Http's net10.0 build - never reference Shiny.Net.Http.Blazor, which was merged into Shiny.Net.Http in v6. It uses the Service Worker Background Sync API. Queued transfers are written to IndexedDB; the Service Worker's sync event handler drains the queue via fetch() and stores download bodies as Blobs back into IndexedDB. When the tab reopens, the C# BrowserHttpTransferManager reconciles results from IndexedDB and fires the IHttpTransferDelegate callbacks.
Ship the bundled SW file or import its handlers from your own service worker:
// my-sw.js
importScripts('./_content/Shiny.Net.Http/http-transfer-sw.js');
Blazor limitations (v1):
Blob; partial-body appending is not supported.Pause(identifier) marks the IndexedDB entry paused so the SW drain skips it (it only processes pending/error), and Resume(identifier) re-queues it. An already in-flight SW fetch() cannot be aborted (no AbortController wiring), so it runs to completion; and because downloads aren't resumable, a resumed download restarts from zero. Pausing a not-yet-started (or retry-pending) transfer works cleanly.Blobs. Fine for small/medium files; very large uploads should wait for a future OPFS streaming path.(manager as Shiny.Net.Http.BrowserHttpTransferManager).GetDownloadBytes(identifier) which reads the blob back out of IndexedDB as a byte[].Do not confuse with Shiny.Jobs on Blazor — Jobs only run while the tab is open because the WASM runtime cannot execute inside a Service Worker. HTTP transfers are the one exception because fetch() is pure JS that the SW can run on its own.
When generating code that uses Shiny HTTP Transfers, follow these conventions:
IHttpTransferManager via dependency injection; never instantiate directly.HttpTransferRequest requires 4 positional parameters: Identifier, Uri, TransferType, LocalFilePath:
var request = new HttpTransferRequest(
"my-download",
"https://example.com/file.zip",
TransferType.Download,
Path.Combine(FileSystem.AppDataDirectory, "file.zip")
);
await transferManager.Queue(request);
Identifier for each HttpTransferRequest so individual transfers can be tracked and cancelled.LocalFilePath points to an existing file before queuing.UseMeteredConnection = false to restrict large transfers to Wi-Fi only.TransferType: UploadMultipart for form-based uploads, UploadRaw for streaming the file body directly, Download for downloads.UpdateReceived C# event on IHttpTransferManager for a global stream of all transfer updates (event EventHandler<HttpTransferResult>). Rx has been removed from Shiny.Net.Http; remember to -= your handler when done.CountChanged event (event EventHandler<int>) to react to the number of active transfers.WatchTransfer(identifier) extension method to await a single transfer to completion — it returns Task<HttpTransferResult> and unsubscribes from UpdateReceived internally.HttpTransferMonitor -- call Start() to begin monitoring and bind to the Transfers collection of HttpTransferObject items. These implement INotifyPropertyChanged.transferManager.Pause(identifier) to stop a transfer without cancelling it. The transfer stays in the queue and reports HttpTransferState.Paused. Use this instead of Cancel(identifier) (which removes the transfer and deletes a download's partial file) when the user may want to continue later.transferManager.Resume(identifier) to continue a paused transfer. Downloads resume from where they left off (HTTP Range on managed platforms; native NSUrlSessionTask.Resume() on iOS/Mac Catalyst). Uploads are not resumable — resuming an upload restarts it from the beginning — except tus uploads (TransferType.UploadTus), which continue from the offset the server reports.Resume.TransferHttpContent.FromJson(obj, MyJsonContext.Default.MyType) to attach a JSON body to an upload - it is trim/AOT safe. The FromJson(object, JsonSerializerOptions?) overload serializes by reflection and is marked [RequiresUnreferencedCode]; only use it where the app is not trimmed.TransferHttpContent.FromFormData(...) to attach form-encoded data.AzureBlobStorageUploadRequest for Azure Blob Storage uploads -- call .WithBlobContainer(tenant, container) or .WithCustomUri(uri), configure auth via .WithSasToken() or .WithSharedKeyAuthorization(), then call .Build() to get an HttpTransferRequest.AwsS3UploadRequest for AWS S3 uploads -- call .WithBucket(bucket, region), configure auth via .WithPresignedUrl() or .WithCredentials(accessKeyId, secretAccessKey), optionally set .WithObjectKey(), .WithContentType(), .WithStorageClass(), then call .Build() to get an HttpTransferRequest. Uses AWS Signature V4 signing with UNSIGNED-PAYLOAD -- no AWS SDK required.TusUploadRequest for resumable uploads to a tus server -- .WithEndpoint(creationUri), optionally .WithMetadata(key, value), .WithBearerToken(token) / .WithHeader(...), .WithChunkSize(bytes), then .Build(). Queue it like any transfer; no extra registration. Pauses, network drops and app restarts resume from the server's Upload-Offset (a dropped connection reports PausedByNoNetwork, not an error). Don't set HttpContent on a tus request (it throws) -- send values as metadata. Not supported on Blazor WASM. On iOS each chunk is a background upload task copied to a temp file, so recommend WithChunkSize for very large files. Prefer tus over UploadRaw/UploadMultipart whenever the server supports it and files are large or connections unreliable.AppleHttpTransferRequest (inherits HttpTransferRequest) when Apple-specific options are needed (e.g., AllowsConstrainedNetworkAccess, AllowsCellularAccess, AssumesHttp3Capable).HttpClient extension methods Upload(...) and Download(...). They return Task and accept an optional Action<TransferProgress> onProgress callback for real-time progress reporting (Rx removed).INativeConfigurator implementation to customize NSUrlSessionConfiguration and NSMutableUrlRequest objects before they are sent.Showing progress to a user who has left the app is one call. Do not hand-roll this from
UpdateReceived.
builder.Services.AddHttpTransfers<MyTransferDelegate>();
builder.Services.AddTransferProgress(opts =>
{
opts.Scope = TransferProgressScope.Summary; // one surface for all (default), or PerTransfer
opts.Fields = TransferProgressFields.Default; // file, direction, %, bytes, speed, ETA
opts.ShortStatus = TransferProgressShortStatus.Percent; // Dynamic Island / status bar chip
});
TransferProgressManager is one manager for every platform: it subscribes at startup (IShinyStartupTask,
because iOS relaunches the app in the background to finish a transfer), coalesces the progress firehose to
one update a second, aggregates a batch, and starts/updates/retires the surface. Renderers only draw.
| Platform | Surface |
|---|---|
| Android 16+ | The foreground-service notification, promoted ongoing (status bar chip, AOD) |
| Android 8-15 | The foreground-service notification with a determinate bar |
| iOS/iPadOS 16.2+ | A Live Activity on the Lock Screen and in the Dynamic Island |
| Elsewhere (macOS, Mac Catalyst, tvOS, Windows, Linux, Blazor) | No renderer; the manager no-ops |
Both renderers ship inside Shiny.Net.Http - there is no second package and no second registration
call. On iOS the package pulls Shiny.Mobile.LiveActivities for you (that reference is on the -ios target
only, so no other head carries ActivityKit) and AddTransferProgress() registers ILiveActivityManager
itself if you have not already called AddLiveActivities(). When the app also uses Live Activities
directly, generate AddLiveActivities(...) before AddTransferProgress() - called after, it registers a
second manager with its own ActivityKit observers.
iOS additionally needs a widget extension in the app bundle and NSSupportsLiveActivities in Info.plist.
Generate <ShinyLiveActivityWidget>true</ShinyLiveActivityWidget> in the app's .csproj (iOS-conditioned
PropertyGroup) - Shiny.Mobile.LiveActivities then builds the stock widget and adds the key, with no Xcode
project. Without it the activity starts and renders nothing - a silent failure, so check this first when an iOS
activity never appears. See the shiny-liveactivities skill for signing details.
The two iOS-only knobs live on the same options object:
builder.Services.AddTransferProgress(opts =>
{
opts.LiveActivity.Kind = "shiny.httptransfers"; // your widget branches on this
opts.LiveActivity.RequestPushToken = true; // see "the iOS suspension gap" below
});
Configuring what shows. Fields is a [Flags] enum (FileName, Direction, Percent,
TransferredBytes, Speed, TimeRemaining, Host) gating the human-readable text only; unselected fields
are simply not written. Raw values (bytes, total, percent, bps, etaSeconds, state, direction,
transferId, fileName, uri) always ride in TransferProgressContent.Data unless IncludeRawData = false. Percent is omitted from the body when it is already the ShortStatus, so it never prints twice.
For custom wording or localization, subclass TransferProgressDelegate and override only what you need
(returning null keeps the built-in string), then register with AddTransferProgress<TDelegate>().
The iOS suspension gap. A background NSURLSession delivers no progress callbacks while the app is
suspended, so a fraction-based bar freezes for most of a long transfer. ProjectTimeRemaining (default on)
emits a self-animating time range instead, anchored in the past so the bar already sits at the true fraction
rather than snapping to zero on every update. Android resolves the range back to a fraction - its foreground
service is alive throughout. For uploads, opts.LiveActivity.RequestPushToken lets a server push
byte-accurate progress through the suspended window - the receiving server knows how many bytes actually
landed. It buys nothing for downloads, where no server knows how far the device has got. The token arrives
on ILiveActivityDelegate.OnPushTokenChanged.
Custom renderers. Implement ITransferProgressRenderer (IsAvailable, Show, Hide, Reconcile) and
register it; the same manager drives it. TransferProgressContentBuilder.FormatBytes/FormatRate/ FormatDuration/FormatPercent are public statics, reusable in ordinary in-app progress UI.
HttpTransferDelegate provides built-in retry and 401-handling logic. Only implement IHttpTransferDelegate directly if you need full control.request.AssertValid() to check the request is well-formed before calling Queue().HttpTransferMonitor to UI, pass a SynchronizationContext to Start() so collection mutations marshal to the UI thread.HttpTransferMonitor implements IDisposable. Dispose it when the page or view model is torn down.UseMeteredConnection = false for large files so the system waits for an unmetered (Wi-Fi) connection.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub shinyorg/skills --plugin shiny57 skills in this plugin
/localizegenGenerate strongly-typed localization classes from .resx resource files using Shiny.Extensions.Localization.Generator for .NET applications/shiny-accessorysetupGenerate code using Shiny.BluetoothLE.AccessorySetup - the system accessory pairing sheet for BLE devices (AccessorySetupKit on iOS 18+, CompanionDeviceManager on Android) with no MFi, no location prompt and no general Bluetooth prompt on iOS; picked accessories open as Shiny.BluetoothLE peripherals, and Android adds background presence (device appeared / disappeared) events/shiny-actorsGenerate code using Shiny.Actors — Orleans-style virtual actors without the ceremony, AOT/trim-clean, running anywhere .NET runs including .NET MAUI and Blazor WebAssembly. Covers actor interfaces and source-generated proxies, the ShinyActorBuilder (AddShinyActors), persistent state with ETags, named states and auto-save, event-sourced JournaledActor with snapshots, state and event migrations, typed streams (durable, implicit consumers), timers and persistent reminders (background jobs via Shiny.Jobs, on-time OS notifications via Shiny.Notifications), concurrency control ([Reentrant], [AlwaysInterleave], [ReadOnly], [StatelessWorker]), call filters and request context, OpenTelemetry traces and metrics, remoting over HTTP (Shiny.Net.HttpServer server, RemoteActorSystem client), mDNS discovery of actor servers, Shiny.DocumentDb storage (SQLite, PostgreSQL, IndexedDB...), and the ActorTestHost testing kit./shiny-agesignalsGenerate code using Shiny.AgeSignals to read the user's age range as the app store shares it - Apple Declared Age Range (iOS / macOS 26+) and Google Play Age Signals (Android) - for app store accountability laws (Texas SB 2420, Utah, Louisiana, California AB 1043) and age-gated features/shiny-aiconversationGenerate code for Shiny.AiConversation v3 - session-based AI conversations for .NET over Microsoft.Extensions.AI with persisted, resumable sessions (IAiSessionManager / IAiSession / IAiTurn), streaming replies, the built-in ask_user tool for typed questions and multiple-choice answers, interruption and supersession, usage and context-window pressure tracking, rolling context compaction, silent assistant memory, conversation search, session titles and long-term memory, session interceptors for tools and prompts, pluggable session/memory stores (in-memory or SQLite via Shiny.AiConversation.Stores.SqliteDocDb), and voice conversations via Shiny.AiConversation.Voice (wake word, push-to-talk, follow-up, quiet-word/barge-in interruption, sentence-streamed text-to-speech over Shiny.Speech, acknowledgement modes, sounds, voice selection tools), the MAUI chat UI via Shiny.AiConversation.Maui (AiChatView bound to a session with streaming bubbles, choice chips, push-to-talk and an AiMemoryView), image attachments with retention, and the use_camera tool via Shiny.AiConversation.Maui.Camera, and AG-UI via Shiny.AiConversation.AgUi (a session as an AG-UI event stream for the Shiny AgentView with ask_user questions as interrupts, the render_ui tool for A2UI surfaces, and a remote AG-UI agent as the chat client)/shiny-appdevicebridgeGenerate code using Shiny.AppDeviceBridge, device bridges on your app's own Shiny.Net.HttpServer that also host a web app (Blazor WebAssembly, React, Vue, any static build) inside a .NET MAUI app on Android, iOS, Mac Catalyst, Windows and the maui-labs macOS and Linux heads — served from a loopback HTTP server, updated over the air from a signed release server, GitHub releases or a provider of your own, and given device access through bridges with typed C# and TypeScript clientsOther plugins' skills for the same job