Class WebSocketConnectionHandler

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

Represents an implementation of IWebSocketConnectionHandler.

[Singleton]
public class WebSocketConnectionHandler : IWebSocketConnectionHandler
Inheritance
WebSocketConnectionHandler
Implements
Inherited Members
Extension Methods

Constructors

WebSocketConnectionHandler(IOptions<ArcOptions>, ILogger<WebSocketConnectionHandler>)

Represents an implementation of IWebSocketConnectionHandler.

public WebSocketConnectionHandler(IOptions<ArcOptions> arcOptions, ILogger<WebSocketConnectionHandler> handlerLogger)

Parameters

arcOptions IOptions<ArcOptions>

The ArcOptions.

handlerLogger ILogger<WebSocketConnectionHandler>

The ILogger.

Methods

HandleIncomingMessages(IWebSocket, SemaphoreSlim, CancellationToken)

Handles all incoming web messages on the given IWebSocket.

public 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.

public 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.