private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { if (e.CloseType != SessionCloseType.Disconnection) { var subscriptions = new string[ActiveSubscriptions.Count]; var i = 0; foreach (var subjectName in ActiveSubscriptions.Keys) { subscriptions[i] = subjectName; i++; } ActiveSubscriptions.Clear(); // Re-initialize WampChannel Start(); // Re-subscribe to subjects #pragma warning disable 4014 for (var j = subscriptions.Length - 1; j >= 0; j--) { var subjectName = subscriptions[j]; switch (subjectName) { case SubjectNameTicker: SubscribeToTickerAsync(); break; case SubjectNameTrollbox: SubscribeToTrollboxAsync(); break; } } #pragma warning restore 4014 } }
public void Stop() { foreach (var subscription in ActiveSubscriptions.Values) { subscription.Dispose(); } ActiveSubscriptions.Clear(); WampChannel.Close(); }
public void Stop() { try { foreach (var subscription in ActiveSubscriptions.Values) { subscription.Dispose(); } ActiveSubscriptions.Clear(); WampChannel.Close(); } catch (Exception e) { Console.WriteLine("Live Stop: " + e.Message); PoloniexBot.CLI.Manager.PrintError(e.Message); } }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { Console.WriteLine("OnConnectionBroken CALLED"); try { foreach (var subscription in ActiveSubscriptions.Values) { subscription.Dispose(); } ActiveSubscriptions.Clear(); PoloniexBot.Trading.Manager.Stop(); PoloniexBot.Trading.Manager.ClearAllPairs(); } catch (Exception ex) { Console.WriteLine("WAMP EXCEPTION (OnConnectionBroken): " + ex.Message); } }
public void Stop() { Console.WriteLine("STOP CALLED"); try { foreach (var subscription in ActiveSubscriptions.Values) { subscription.Dispose(); } ActiveSubscriptions.Clear(); PoloniexBot.Trading.Manager.Stop(); PoloniexBot.Trading.Manager.ClearAllPairs(); WampChannel.Close(); } catch (Exception ex) { Console.WriteLine("WAMP EXCEPTION (Stop): " + ex.Message); } }
private void OnConnectionBroken(object sender, WampSessionCloseEventArgs e) { if (e.CloseType != SessionCloseType.Disconnection) { var subscriptions = new string[ActiveSubscriptions.Count]; var i = 0; foreach (var subjectName in ActiveSubscriptions.Keys) { subscriptions[i] = subjectName; i++; } ActiveSubscriptions.Clear(); try { // Re-initialize WampChannel Start(); // Re-subscribe to subjects #pragma warning disable 4014 for (var j = subscriptions.Length - 1; j >= 0; j--) { var subjectName = subscriptions[j]; switch (subjectName) { case SubjectNameTicker: SubscribeToTickerAsync(); break; case SubjectNameTrollbox: SubscribeToTrollboxAsync(); break; } } #pragma warning restore 4014 } catch (Exception ex) { Console.WriteLine("Live OnConnectionBroken: " + ex.Message); PoloniexBot.CLI.Manager.PrintError(ex.Message); } } }