Skip to main content

ISignalRClient<TOptions>

Namespace: Meshmakers.Octo.Sdk.ServiceClient

Interface of the SignalR client.

public interface ISignalRClient<TOptions>

Type Parameters​

TOptions

Properties​

ClientAccessToken​

Client access token.

public abstract IServiceClientAccessToken ClientAccessToken { get; }

Property Value​

IServiceClientAccessToken

Options​

Options of the SignalR client.

public abstract TOptions Options { get; }

Property Value​

TOptions

ServiceUri​

Returns the service URI of the SignalR hub

public abstract Uri ServiceUri { get; }

Property Value​

Uri

IsAlive​

Returns true if the SignalR client is connected to the hub and false otherwise.

public abstract bool IsAlive { get; }

Property Value​

Boolean

Remarks:

False is only returned if the connection is interrupted or if the client is not started, which includes the time between ISignalRClient<TOptions>.StopAsync() and the next ISignalRClient<TOptions>.StartAsync(Func<Boolean, Task>, CancellationToken). See for more details. This is a state query: it never throws and never creates a connection, so it is safe to poll at any point of the client's lifetime.

Methods​

EnableReconnect(Func<Boolean, Task>)​

Enables the automatic reconnect of the SignalR client.

void EnableReconnect(Func<bool, Task> onReconnectFunction)

Parameters​

onReconnectFunction Func<Boolean, Task>
Function to be called when the client reconnects.

StartAsync(Func<Boolean, Task>, CancellationToken)​

Starts the communication with the SignalR hub.

Task StartAsync(Func<bool, Task> onConnectFunction, CancellationToken stoppingToken)

Parameters​

onConnectFunction Func<Boolean, Task>
Function to be called when the client connects.

stoppingToken CancellationToken
Cancellation connection

Returns​

Task

StopAsync()​

Stops the communication with the SignalR hub.

Task StopAsync()

Returns​

Task