Table of Contents

Interface IObservableQueryHandler

Namespace
Cratis.Applications.Queries
Assembly
Cratis.Applications.dll

Defines a handler for WebSocket-based query operations.

public interface IObservableQueryHandler
Extension Methods

Methods

HandleStreamingResult(HttpContext, QueryName, object, QueryContext)

Handles a streaming query result for WebSocket connections in minimal API endpoints.

Task HandleStreamingResult(HttpContext httpContext, QueryName queryName, object streamingData, QueryContext queryContext)

Parameters

httpContext HttpContext

The HttpContext for the request.

queryName QueryName

The name of the query being executed.

streamingData object

The streaming data (Subject or AsyncEnumerable).

queryContext QueryContext

The query context.

Returns

Task

A Task representing the asynchronous operation.

HandleStreamingResult(ActionExecutingContext, ActionExecutedContext?, ObjectResult)

Handles a streaming query result for WebSocket connections in controller actions.

Task HandleStreamingResult(ActionExecutingContext context, ActionExecutedContext? actionExecutedContext, ObjectResult objectResult)

Parameters

context ActionExecutingContext

The ActionExecutingContext.

actionExecutedContext ActionExecutedContext

The ActionExecutedContext from the action execution.

objectResult ObjectResult

The ObjectResult containing the streaming data.

Returns

Task

A Task representing the asynchronous operation.

IsStreamingResult(object?)

Determines if the given data is a streaming result that can be handled via WebSocket.

bool IsStreamingResult(object? data)

Parameters

data object

The data to check.

Returns

bool

True if the data is a streaming result, false otherwise.

ShouldHandleAsWebSocket(HttpContext)

Determines if the current request should be handled as a WebSocket connection.

bool ShouldHandleAsWebSocket(HttpContext httpContext)

Parameters

httpContext HttpContext

The HttpContext.

Returns

bool

True if the request should be handled as WebSocket, false otherwise.

ShouldHandleAsWebSocket(ActionExecutingContext)

Determines if the current request should be handled as a WebSocket connection.

bool ShouldHandleAsWebSocket(ActionExecutingContext context)

Parameters

context ActionExecutingContext

The ActionExecutingContext.

Returns

bool

True if the request should be handled as WebSocket, false otherwise.