Class StreamingCollectionEndpoint<TEntity, TElementEndpoint>
Endpoint for a collection of TEntity
s observable as an append-only stream using long-polling.
public class StreamingCollectionEndpoint<TEntity, TElementEndpoint> : CollectionEndpoint<TEntity, TElementEndpoint>, ICachingEndpoint, IStreamingCollectionEndpoint<TEntity, TElementEndpoint>, ICollectionEndpoint<TEntity, TElementEndpoint>, IIndexerEndpoint<TElementEndpoint>, IEndpoint where TEntity : class where TElementEndpoint : class, IElementEndpoint<TEntity>
Type Parameters
TEntity
The type of individual elements in the collection.
TElementEndpoint
The type of IEndpoint to provide for individual
TEntity
s. Must have a public constructor with an IEndpoint and an Uri or string parameter.
- Inheritance
-
CollectionEndpoint<TEntity, TElementEndpoint>StreamingCollectionEndpoint<TEntity, TElementEndpoint>
- Implements
-
IStreamingCollectionEndpoint<TEntity, TElementEndpoint>ICollectionEndpoint<TEntity, TElementEndpoint>IIndexerEndpoint<TElementEndpoint>
- Derived
- Inherited Members
- Extension Methods
Constructors
StreamingCollectionEndpoint(IEndpoint, string)
Creates a new streaming collection endpoint.
public StreamingCollectionEndpoint(IEndpoint referrer, string relativeUri)
Parameters
referrer
IEndpointThe endpoint used to navigate to this one.
relativeUri
stringThe URI of this endpoint relative to the
referrer
's. Add a./
prefix here to imply a trailing slashreferrer
's URI.
StreamingCollectionEndpoint(IEndpoint, Uri)
Creates a new streaming collection endpoint.
public StreamingCollectionEndpoint(IEndpoint referrer, Uri relativeUri)
Parameters
referrer
IEndpointThe endpoint used to navigate to this one.
relativeUri
UriThe URI of this endpoint relative to the
referrer
's.
Properties
PollingInterval
The interval in which to send requests to the server.
The server can modify this value using the Retry-After
header.
public TimeSpan PollingInterval { get; set; }
Property Value
Methods
GetObservable(long)
Provides an observable stream of elements.
public IObservable<TEntity> GetObservable(long startIndex = 0)
Parameters
startIndex
longThe index of the first element to return in the stream. Use negative values to start counting from the end of the stream.
Returns
- IObservable<TEntity>
A cold observable. HTTP communication only starts on Subscribe(IObserver<T>).
HandleAsync(Func<Task<HttpResponseMessage>>, string)
Handles various cross-cutting concerns regarding a response message such as discovering links and handling errors.
protected override Task<HttpResponseMessage> HandleAsync(Func<Task<HttpResponseMessage>> request, string caller = "unknown")
Parameters
request
Func<Task<HttpResponseMessage>>A callback that performs the actual HTTP request.
caller
stringThe name of the method calling this method.
Returns
- Task<HttpResponseMessage>
The HTTP response.