Skip to content
Client v5: BLE, BLE Hosting, HTTP, Jobs - Linux, MacOS, & Blazor Support! Full AOT, RX on BLE only & MANY other features! Check It Out

Monitoring

Monitor transfer progress in real-time using C# events on IHttpTransferManager, the awaitable WatchTransfer helper, or the HttpTransferMonitor collection helper for UI binding. Rx has been removed from Shiny.Net.Http — everything is plain event EventHandler or Task.

IHttpTransferManager manager; // injected
manager.UpdateReceived += (sender, result) =>
{
Console.WriteLine($"Transfer: {result.Request.Identifier}");
Console.WriteLine($"Status: {result.Status}");
Console.WriteLine($"Progress: {result.Progress.PercentComplete:P0}");
Console.WriteLine($"Speed: {result.Progress.BytesPerSecond} B/s");
Console.WriteLine($"ETA: {result.Progress.EstimatedTimeRemaining}");
};
// Don't forget to detach the handler on dispose/disappear
// manager.UpdateReceived -= handler;

WatchTransfer returns a Task<HttpTransferResult> that completes when the transfer reaches Completed or Canceled, throws on failure, and unhooks internally.

try
{
var result = await manager.WatchTransfer("upload-1");
Console.WriteLine($"Completed at {result.Progress.PercentComplete:P0}");
}
catch (Exception ex)
{
Console.WriteLine($"Failed: {ex.Message}");
}
manager.CountChanged += (sender, count) =>
{
Console.WriteLine($"Active transfers: {count}");
};
PropertyTypeDescription
RequestHttpTransferRequestThe original request
StatusHttpTransferStateCurrent transfer state
ProgressTransferProgressProgress details
ExceptionException?Error details if failed
PropertyTypeDescription
BytesPerSecondlongCurrent transfer speed
BytesToTransferlong?Total bytes (null if indeterminate)
BytesTransferredlongBytes transferred so far
PercentCompletedouble0-1 range, or -1 if indeterminate
EstimatedTimeRemainingTimeSpanEstimated completion time
ValueDescription
PendingQueued, waiting to start
InProgressCurrently transferring
PausedPaused by user/system
PausedByNoNetworkPaused due to no network
PausedByCostedNetworkPaused due to metered network
CompletedSuccessfully completed
ErrorFailed with error
CanceledCancelled by user

HttpTransferMonitor provides a BindingList<HttpTransferObject> ideal for binding to UI. Pass a SynchronizationContext to Start if you want collection mutations marshalled to the UI thread.

HttpTransferMonitor monitor; // injected (registered by AddHttpTransfers)
// Start monitoring on the UI thread
await monitor.Start(
SynchronizationContext.Current,
removeFinished: true,
removeErrors: true,
removeCancelled: true
);
// Bind to the collection
var transfers = monitor.Transfers; // BindingList<HttpTransferObject>
// Each HttpTransferObject has:
// - Identifier, Uri, Type
// - Status, PercentComplete, BytesPerSecond
// - BytesToTransfer, BytesTransferred
// - EstimatedTimeRemaining, IsDeterministic
// Stop monitoring
monitor.Stop();
// Clear completed/errored transfers from the list
monitor.Clear(removeFinished: true, removeCancelled: true, removeErrors: true);