Interface IWebSocketConnectionHandler

Namespace
Cratis.Arc.Queries
Assembly
Cratis.Arc.Core.dll

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

public interface IWebSocketConnectionHandler
Extension Methods

Methods

HandleIncomingMessages(IWebSocket, SemaphoreSlim, CancellationToken)

Handles all incoming web messages on the given IWebSocket.

Task HandleIncomingMessages(IWebSocket webSocket, SemaphoreSlim writeLock, CancellationToken token)

Parameters

webSocket IWebSocket

The IWebSocket to listen to.

writeLock SemaphoreSlim

A per-connection SemaphoreSlim that serializes all sends on this socket.

token CancellationToken

The CancellationToken.

Returns

Task

A Task representing the asynchronous action.

SendMessage(IWebSocket, QueryResult, SemaphoreSlim, CancellationToken)

Sends a message on the IWebSocket.

Task<Exception?> SendMessage(IWebSocket webSocket, QueryResult queryResult, SemaphoreSlim writeLock, CancellationToken token)

Parameters

webSocket IWebSocket

The IWebSocket to send on.

queryResult QueryResult

The QueryResult message to write.

writeLock SemaphoreSlim

A per-connection SemaphoreSlim that serializes all sends on this socket.

token CancellationToken

The CancellationToken.

Returns

Task<Exception>

A Task representing the asynchronous action.