Class ClientObservable<T>
- Namespace
- Cratis.Applications.Queries
- Assembly
- Cratis.Applications.dll
Represents an implementation of IClientObservable.
public class ClientObservable<T> : IClientObservable, IAsyncEnumerable<T>
Type Parameters
T
Type of data being observed.
- Inheritance
-
ClientObservable<T>
- Implements
- Inherited Members
Remarks
Initializes a new instance of the ClientObservable<T> class.
Constructors
ClientObservable(QueryContext, ISubject<T>, JsonOptions, IWebSocketConnectionHandler, IHostApplicationLifetime, ILogger<ClientObservable<T>>)
Represents an implementation of IClientObservable.
public ClientObservable(QueryContext queryContext, ISubject<T> subject, JsonOptions jsonOptions, IWebSocketConnectionHandler webSocketConnectionHandler, IHostApplicationLifetime hostApplicationLifetime, ILogger<ClientObservable<T>> logger)
Parameters
queryContext
QueryContextThe QueryContext the observable is for.
subject
ISubject<T>The System.Reactive.Subjects.ISubject<T> the observable wraps.
jsonOptions
JsonOptionsThe JsonOptions.
webSocketConnectionHandler
IWebSocketConnectionHandlerhostApplicationLifetime
IHostApplicationLifetimelogger
ILogger<ClientObservable<T>>The ILogger.
Remarks
Initializes a new instance of the ClientObservable<T> class.
Methods
GetAsyncEnumerator(CancellationToken)
Returns an enumerator that iterates asynchronously through the collection.
public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA CancellationToken that may be used to cancel the asynchronous iteration.
Returns
- IAsyncEnumerator<T>
An enumerator that can be used to iterate asynchronously through the collection.
GetAsynchronousEnumerator(CancellationToken)
Get an async enumerator for the observable.
public object GetAsynchronousEnumerator(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenOptional CancellationToken.
Returns
- object
Async enumerator.
HandleConnection(ActionExecutingContext)
Handle the action context and result from the action.
public Task HandleConnection(ActionExecutingContext context)
Parameters
context
ActionExecutingContextActionExecutingContext to handle for.
Returns
OnNext(T)
Notifies all subscribed and future observers about the arrival of the specified element in the sequence.
public void OnNext(T next)
Parameters
next
TThe value to send to all observers.