Class SseStreamingEndpoint<TEntity>
Endpoint for a stream of TEntitys using Server-Sent Events (SSE).
public class SseStreamingEndpoint<TEntity> : EndpointBase, IStreamingEndpoint<TEntity>, IEndpoint
Type Parameters
TEntityThe type of individual elements in the stream.
- Inheritance
-
objectSseStreamingEndpoint<TEntity>
- Implements
-
IStreamingEndpoint<TEntity>
- 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
referrerIEndpointThe endpoint used to navigate to this one.
relativeUristringThe URI of this endpoint relative to the
referrer's. Add a./prefix here to imply a trailing slashreferrer's URI.eventTypestringIf set, only events with this
event:type are emitted; others are ignored.nullemits 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
referrerIEndpointThe endpoint used to navigate to this one.
relativeUriUriThe URI of this endpoint relative to the
referrer's.eventTypestringIf set, only events with this
event:type are emitted; others are ignored.nullemits 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
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
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>).