/// <summary> /// Gets the collection of available services for the provided credentials. /// </summary> /// <typeparam name="TCredentials">The type of the credentials.</typeparam> /// <typeparam name="TReportedServiceInformation">The type of the reported service information.</typeparam> /// <param name="credentials">The credentials.</param> /// <param name="url">The URL.</param> /// <param name="mode">The mode.</param> /// <returns></returns> public async Task <List <TReportedServiceInformation> > GetAvailableServicesAsync <TCredentials, TReportedServiceInformation>(TCredentials credentials, String url, SignalRMode mode) where TReportedServiceInformation : IResonanceServiceInformation { ISignalRClient client = SignalRClientFactory.Default.Create(mode, url); await client.StartAsync(); var services = await client.InvokeAsync <List <TReportedServiceInformation> >(ResonanceHubMethods.GetAvailableServices, credentials); await client.DisposeAsync(); return(services); }
/// <summary> /// Stop discovering. /// </summary> public async Task StopAsync() { if (IsStarted) { try { await _client.DisposeAsync(); } catch { } IsStarted = false; } }
/// <summary> /// Disposes component resources asynchronously. /// </summary> /// <returns></returns> public async Task DisposeAsync() { if (!IsDisposed) { try { await UnregisterAsync(); } catch (Exception ex) { Logger.LogError(ex, "Error occurred while disposing the registered service. Unregister service failed."); } IsDisposed = true; await _client?.StopAsync(); await _client?.DisposeAsync(); _client = null; } }
/// <summary> /// Called when the adapter is disconnecting. /// </summary> /// <param name="notify">if set to <c>true</c> to notify the other side about the disconnection.</param> private async Task OnDisconnect(bool notify) { try { if (notify) { await _client.InvokeAsync(ResonanceHubMethods.Disconnect); } await _client.StopAsync(); await _client.DisposeAsync(); } catch (Exception ex) { Logger.LogError(ex, $"Error occurred while disconnecting."); } Logger.LogInformation("Disconnected."); if (!notify && !IsFailing) { OnFailed(new RemoteAdapterDisconnectedException(), "The remote SignalR adapter has disconnected."); } }
public ValueTask DisposeAsync() { _hubHandlerRegistries?.Dispose(); return(_client.DisposeAsync()); }
public ValueTask DisposeAsync() { _callbacks.Dispose(); return(_client.DisposeAsync()); }
public async Task StopAsync(CancellationToken cancellationToken) { await fHubClient.DisposeAsync().AsTask(); }