Table of Contents

Namespace TypedRest.Endpoints.Reactive

Reactive endpoints allow you to receive data as push streams rather than explicitly pulling.

Note

NuGet package: TypedRest.Reactive

All of these endpoints expose their data through a GetObservable() method. The observable is cold: no request is sent until something subscribes, and the connection is closed again when the subscription is disposed. The polling and streaming collection variants additionally derive from their pull-based counterparts in TypedRest.Endpoints.Generic, so one instance serves both access patterns; streaming and SSE endpoints only push.

How the data actually gets there stays hidden behind IObservable<T>. Polling lets the server dictate the rate via a Retry-After header, and an optional end condition completes the stream once the entity reaches its final state. Streaming splits the entities the server writes into the open response body on a configurable separator. A streaming collection uses ranged requests with long polling to wait for new elements.

Where a stream begins matters for the collection variant, since its elements persist: GetObservable(startIndex) can replay from the beginning, resume at a known offset, or take a negative index to show the last few entries before following along live.

var messages = new StreamingCollectionEndpoint<Message>(client, "./messages");

using var subscription = messages.GetObservable(startIndex: -10)
                                 .Subscribe(m => Console.WriteLine(m.Text));

Classes

PollingEndpoint<TEntity>

Endpoint for a resource that can be polled for state changes.

SseStreamingEndpoint<TEntity>

Endpoint for a stream of TEntitys using Server-Sent Events (SSE).

StreamingCollectionEndpoint<TEntity>

Endpoint for a collection of TEntitys observable as an append-only stream using long-polling.

StreamingCollectionEndpoint<TEntity, TElementEndpoint>

Endpoint for a collection of TEntitys observable as an append-only stream using long-polling.

StreamingEndpoint<TEntity>

Endpoint for a stream of TEntitys using a persistent HTTP connection.

Interfaces

IPollingEndpoint<TEntity>

Endpoint for a resource that can be polled for state changes.

IStreamingCollectionEndpoint<TEntity>

Endpoint for a collection of TEntitys observable as an append-only stream.

IStreamingCollectionEndpoint<TEntity, TElementEndpoint>

Endpoint for a collection of TEntitys observable as an append-only stream.

IStreamingEndpoint<TEntity>

Endpoint for a stream of TEntitys.