shinyorg/shiny/shiny-http-transfers
Claude Code and agent skill by shinyorg/shiny
- community
Checking that the SKILL.md file is still in the repository.
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
Install
npx vskill@latest install shinyorg/shiny/shiny-http-transfersSKILL.md
The same SKILL.md was published earlier as shinyorg/shiny/shiny-http-transfers.
Shiny HTTP Transfers
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).
When to Use This Skill
Use this skill when the user needs to:
- Upload or download files in the background on iOS/Android
- Monitor progress of HTTP file transfers
- Queue background transfers that survive app suspension
- Handle transfer errors with automatic retry logic
- Upload files to Azure Blob Storage
- Upload files to AWS S3
- Build a UI that tracks active transfers with progress reporting
- Perform multipart or raw file uploads
- Download files with progress tracking and estimated time remaining
Library Overview
| Item | Value | |
|---|---|---|
| NuGet | Shiny.Net.Http (one package everywhere - its net11.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.
Setup
1. Register Services
In your MauiProgram.cs:
2. Implement the Delegate
Create a class that implements IHttpTransferDelegate (or inherits from the abstract HttpTransferDelegate base class for built-in retry logic):
On Android, the delegate must also implement IAndroidForegroundServiceDelegate:
Linux / macOS / Plain .NET Setup
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. Only a partial file the transfer itself wrote is resumed - a file already at LocalFilePath before the download was queued is overwritten - and a 416 for an already-complete partial file completes the transfer. The resume also checks the server file hasn't changed: the response that starts a download has its strong ETag (weak W/ tags are ignored) or, failing that, its Last-Modified stored internally beside the transfer, and the resume sends it as If-Range. A 206 appends; a 200 means the file changed, so the partial is truncated and the download restarts from byte 0 with the new validator. With neither header the resume is a plain Range request. The validator is removed with the transfer (completed, failed, cancelled). Apple (NSURLSession) does its own resume validation; Blazor has no resume. For safe resumes, servers should send a strong ETag - no app code is needed. A connection failure (no HTTP status) pauses a transfer as PausedByNoNetwork for the next pass instead of failing it.
TransferProgress.IsDeterministic is false for an unknown, zero or negative (iOS "unknown size") total; PercentComplete is then -1 and EstimatedTimeRemaining is zero.
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.
Blazor WASM Setup (Shiny.Net.Http)
AddBlazorHttpTransfers ships in Shiny.Net.Http's net11.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:
Blazor limitations (v1):
- No resumable downloads — the SW receives a whole response
Blob; partial-body appending is not supported. - Retries — the SW retries a transfer that failed with no status (network),
408,429or5xxup to 5 times (it goes back topending, noOnError); other statuses, or exhausted retries, mark iterrorand fireOnErroronce. Drains are serialised, so a transfer is sent once even when thesyncevent and the page's drain message arrive together, and a transfer the worker was stopped in the middle of is picked up again. - Pause/Resume is best-effort —
Pause(identifier)marks the IndexedDB entrypausedso the SW drain skips it (it only processespending), andResume(identifier)re-queues it. An already in-flight SWfetch()cannot be aborted (noAbortControllerwiring), 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. - Upload bodies are base64-bridged through JS interop and persisted as IndexedDB
Blobs. Fine for small/medium files; very large uploads should wait for a future OPFS streaming path. - Browser support for Background Sync is Chromium-only (no Firefox, no Safari). On unsupported browsers queued transfers drain while the tab is foreground and then sit in IndexedDB until next visit.
- Retrieving completed downloads: use
(manager as Shiny.Net.Http.BrowserHttpTransferManager).GetDownloadBytes(identifier)which reads the blob back out of IndexedDB as abyte[].
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.
Code Generation Instructions
When generating code that uses Shiny HTTP Transfers, follow these conventions:
Queuing Transfers
- Always use
IHttpTransferManagervia dependency injection; never instantiate directly. HttpTransferRequestrequires 4 positional parameters:Identifier,Uri,TransferType,LocalFilePath:
``csharp var request = new HttpTransferRequest( "my-download", "https://example.com/file.zip", TransferType.Download, Path.Combine(FileSystem.AppDataDirectory, "file.zip") ); await transferManager.Queue(request); ``
- Use a unique
Identifierfor eachHttpTransferRequestso individual transfers can be tracked and cancelled. - For uploads, ensure the
LocalFilePathpoints to an existing file before queuing. - Set
UseMeteredConnection = falseto restrict large transfers to Wi-Fi only. - Choose the correct
TransferType:UploadMultipartfor form-based uploads,UploadRawfor streaming the file body directly,Downloadfor downloads.
Monitoring Progress
- Subscribe to the
UpdateReceivedC# event onIHttpTransferManagerfor a global stream of all transfer updates (event EventHandler<HttpTransferResult>). Rx has been removed fromShiny.Net.Http; remember to-=your handler when done. - Subscribe to the
CountChangedevent (event EventHandler<int>) to react to the number of active transfers. - Use the
WatchTransfer(identifier)extension method toawaita single transfer to completion — it returnsTask<HttpTransferResult>and unsubscribes fromUpdateReceivedinternally. - For UI binding, use
HttpTransferMonitor-- callStart()to begin monitoring and bind to theTransferscollection ofHttpTransferObjectitems. These implementINotifyPropertyChanged.
Pausing & Resuming
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/shiny-http-transfers/SKILL.md
Popularity
- Repository stars
- 1,583
- Repository forks
- 248
- 7-day trend score
- 37
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/shinyorg/shiny/shiny-http-transfers)