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
WebSocketThe WebSocket to listen to.
token
CancellationTokenThe CancellationToken.
logger
ILoggerThe optional ILogger to use.
Returns
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
WebSocketThe WebSocket to listen to.
queryResult
QueryResult<TQueryResult>The QueryResult<T> message to write.
jsonSerializerOptions
JsonSerializerOptionstoken
CancellationTokenThe CancellationToken.
logger
ILoggerThe optional ILogger to use.
Returns
Type Parameters
TQueryResult
The Type of the query result.