Table of Contents

Class FirmwareApiFallbackHandler

Namespace
Huddly.Sdk.Gateways
Assembly
Huddly.Sdk.dll

An HTTP message handler that retries a firmware API request against the next URL in a prioritized list of firmware API URLs when the server is unreachable or unavailable.

public sealed class FirmwareApiFallbackHandler : DelegatingHandler, IDisposable
Inheritance
FirmwareApiFallbackHandler
Implements
Inherited Members

Remarks

A request is retried against the next URL when it fails before a response is received (DNS, connection or TLS errors) or when the server responds with a status code indicating that it is unavailable (408, 429 or any 5xx). All other responses, including 4xx responses such as 404 Not Found, are returned as-is. When every URL fails, the response or exception from the last URL is returned. Requests to a URL that is not in the list, or to the last URL in the list, are sent as-is without fallback. Each attempt that has a fallback is given Huddly.Sdk.Gateways.FirmwareApiFallbackHandler.AttemptTimeout to respond before the next URL is tried.

Constructors

FirmwareApiFallbackHandler()

Creates a handler that falls back between the FirmwareApiUrls.

public FirmwareApiFallbackHandler()

FirmwareApiFallbackHandler(IEnumerable<Uri>)

Creates a handler that falls back between the given firmware API URLs, in order.

public FirmwareApiFallbackHandler(IEnumerable<Uri> firmwareApiUrls)

Parameters

firmwareApiUrls IEnumerable<Uri>

Methods

SendAsync(HttpRequestMessage, CancellationToken)

Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.

[SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "The re-targeted request has no content to dispose and is returned as the RequestMessage of the response, which owns it from then on.")]
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Parameters

request HttpRequestMessage

The HTTP request message to send to the server.

cancellationToken CancellationToken

A cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

The request was null.

OperationCanceledException

The cancellation token was canceled. This exception is stored into the returned task.