private async Task <bool> TryStart() { try { await connection.Start().ConfigureAwait(false); } catch (Exception ex) { log.Write(LogVerbosity.Warning, $"Couldn't connect. {ex.GetType()}"); log.Write(LogVerbosity.Debug, $" {ex.Message}"); return(false); } log.Write(LogVerbosity.Info, "Socket connection established"); // subscribe to all market deltas await proxy.Invoke(MarketDeltaSub).ConfigureAwait(false); IEnumerable <BittrexExchangeDeltasRegistration> marketRegistrations; lock (registrationLock) marketRegistrations = registrations.OfType <BittrexExchangeDeltasRegistration>(); foreach (var registration in marketRegistrations) { await SubscribeToExchangeDeltas(registration.MarketName).ConfigureAwait(false); } return(true); }
private IObservable <Unit> StartConnectionAction() { return(m_hubConnection .Start() .Catch <Unit, Exception>(ex => { Debug.LogException(ex); return Observable.Never(Unit.Default); }) .ContinueWith(_ => { Debug.Log($"{nameof(BootstrapTree)}: the connection was open!"); return Observable.ReturnUnit(); })); }
private async Task <bool> TryStart() { try { await connection.Start().ConfigureAwait(false); } catch (Exception ex) { log.Write(LogVerbosity.Warning, $"Couldn't connect. {ex.GetType()}"); log.Write(LogVerbosity.Debug, $" {ex.Message}"); return(false); } log.Write(LogVerbosity.Info, "Socket connection established"); return(true); }
public void ConnectToServer() { _hubProxy = _hubConnection.CreateHubProxy("MessageHub"); // must match hub name _hubProxy.On <DateTime>("ReceiveMessage", ReceiveMessage); _hubConnection.Start(); }