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
- Extension Methods
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
- queryContextQueryContext
- The QueryContext the observable is for. 
- subjectISubject<T>
- The System.Reactive.Subjects.ISubject<T> the observable wraps. 
- jsonOptionsJsonOptions
- The JsonOptions. 
- webSocketConnectionHandlerIWebSocketConnectionHandler
- hostApplicationLifetimeIHostApplicationLifetime
- loggerILogger<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
- cancellationTokenCancellationToken
- A 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
- cancellationTokenCancellationToken
- Optional CancellationToken. 
Returns
- object
- Async enumerator. 
HandleConnection(HttpContext)
Handle the HTTP context for minimal API endpoints.
public Task HandleConnection(HttpContext httpContext)Parameters
- httpContextHttpContext
- HttpContext to handle for. 
Returns
HandleConnection(ActionExecutingContext)
Handle the action context and result from the action.
public Task HandleConnection(ActionExecutingContext context)Parameters
- contextActionExecutingContext
- ActionExecutingContext 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
- nextT
- The value to send to all observers.