Table of Contents

Interface IWebSocketConnectionHandler

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

Defines a system that knows how to handle the WebSocket connection for observable queries.

public interface IWebSocketConnectionHandler

Methods

HandleIncomingMessages(WebSocket, CancellationToken, ILogger?)

Handles all incoming web messages on the given WebSocket.

Task HandleIncomingMessages(WebSocket webSocket, CancellationToken token, ILogger? logger = null)

Parameters

webSocket WebSocket

The WebSocket to listen to.

token CancellationToken

The CancellationToken.

logger ILogger

The optional ILogger to use.

Returns

Task

A Task representing the asynchronous action.

SendMessage<TQueryResult>(WebSocket, QueryResult<TQueryResult>, JsonSerializerOptions, CancellationToken, ILogger?)

Sends a message on the WebSocket.

Task<Exception?> SendMessage<TQueryResult>(WebSocket webSocket, QueryResult<TQueryResult> queryResult, JsonSerializerOptions jsonSerializerOptions, CancellationToken token, ILogger? logger = null)

Parameters

webSocket WebSocket

The WebSocket to listen to.

queryResult QueryResult<TQueryResult>

The QueryResult<T> message to write.

jsonSerializerOptions JsonSerializerOptions

The JsonSerializerOptions.

token CancellationToken

The CancellationToken.

logger ILogger

The optional ILogger to use.

Returns

Task<Exception>

A Task representing the asynchronous action.

Type Parameters

TQueryResult

The Type of the query result.