Table of Contents

HttpWatcher Class

Definition

Namespace
Cuemon.Net.Http
Assemblies
Cuemon.Net.dll
Source
src/Cuemon.Net/Http/HttpWatcher.cs

Provides a watcher implementation designed to monitor and signal changes applied to an URI resource by raising the Changed event.

public class HttpWatcher : Watcher, IWatcher, IDisposable
Inheritance
HttpWatcher
Implements
Inherited Members

Examples

The following example demonstrates how to configure an for a remote URI and inspect its active monitoring settings.

using System;
using Cuemon.Net.Http;

namespace MyApp.Examples;

public static class HttpWatcherExample
{
    public static void Demonstrate()
    {
        var watcher = new HttpWatcher(new Uri("https://example.com/feed"), options =>
        {
            options.ReadResponseBody = true;
            options.Period = TimeSpan.FromSeconds(10);
        });

        Console.WriteLine(watcher.Location);
        Console.WriteLine(watcher.ReadResponseBody);
        Console.WriteLine(watcher.HashFactory != null);
    }
}

Constructors

Name Description
HttpWatcher(Uri, Action<HttpWatcherOptions>)

Initializes a new instance of the HttpWatcher class.

Properties

Name Description
Checksum

Gets the checksum that is associated with the URI specified in Location.

ClientFactory

Gets the function delegate that will resolve an instance of HttpClient.

HashFactory

Gets the function delegate that will resolve an implementation of Hash.

Location

Gets the URI of the resource to watch.

ReadResponseBody

Gets a value indicating whether to compute a hash from the response body.

Methods

Name Description
HandleSignalingAsync()

Handles the signaling of this HttpWatcher.

See Also