Table of Contents

Class SseStreamingEndpoint<TEntity>

Namespace
TypedRest.Endpoints.Reactive
Assembly
TypedRest.Reactive.dll

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

public class SseStreamingEndpoint<TEntity> : EndpointBase, IStreamingEndpoint<TEntity>, IEndpoint

Type Parameters

TEntity

The type of individual elements in the stream.

Inheritance
object
SseStreamingEndpoint<TEntity>
Implements
Inherited Members

Remarks

Sends Accept: text/event-stream. By default, transparently reconnects on connection drops or transient errors, honoring the server-supplied retry: interval and resuming via the Last-Event-ID header.

Constructors

SseStreamingEndpoint(IEndpoint, string, string?)

Creates a new SSE streaming endpoint.

public SseStreamingEndpoint(IEndpoint referrer, string relativeUri, string? eventType = null)

Parameters

referrer IEndpoint

The endpoint used to navigate to this one.

relativeUri string

The URI of this endpoint relative to the referrer's. Add a ./ prefix here to imply a trailing slash referrer's URI.

eventType string

If set, only events with this event: type are emitted; others are ignored. null emits all events.

SseStreamingEndpoint(IEndpoint, Uri, string?)

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

public SseStreamingEndpoint(IEndpoint referrer, Uri relativeUri, string? eventType = null)

Parameters

referrer IEndpoint

The endpoint used to navigate to this one.

relativeUri Uri

The URI of this endpoint relative to the referrer's.

eventType string

If set, only events with this event: type are emitted; others are ignored. null emits all events.

Remarks

Sends Accept: text/event-stream. By default, transparently reconnects on connection drops or transient errors, honoring the server-supplied retry: interval and resuming via the Last-Event-ID header.

Properties

AutoReconnect

Whether to transparently reconnect on connection drops, transient transport errors, and 5xx responses.

public bool AutoReconnect { get; set; }

Property Value

bool

DefaultReconnectionInterval

The reconnection interval used when the server has not (yet) supplied one via the SSE retry: field.

public TimeSpan DefaultReconnectionInterval { get; set; }

Property Value

TimeSpan

Methods

GetObservable()

Provides an observable stream of entities.

public virtual IObservable<TEntity> GetObservable()

Returns

IObservable<TEntity>

A cold observable. HTTP communication only starts on Subscribe(IObserver<T>).