1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-20 04:42:57 +00:00

Added ConnectionClosed event for when no reconnecting is happening

This commit is contained in:
Jkorf
2021-08-24 13:25:11 +02:00
parent d775d228da
commit 307aab130b
5 changed files with 46 additions and 14 deletions
@@ -247,11 +247,16 @@ namespace CryptoExchange.Net.OrderBook
subscription = startResult.Data;
subscription.ConnectionLost += () =>
{
log.Write(LogLevel.Warning, $"{Id} order book {Symbol} connection lost");
Status = OrderBookStatus.Reconnecting;
Reset();
};
subscription.ConnectionClosed += () =>
{
log.Write(LogLevel.Warning, $"{Id} order book {Symbol} disconnected");
Status = OrderBookStatus.Disconnected;
StopAsync();
};
subscription.ConnectionRestored += async time => await ResyncAsync().ConfigureAwait(false);
Status = OrderBookStatus.Synced;
@@ -336,6 +341,7 @@ namespace CryptoExchange.Net.OrderBook
if(subscription != null)
await subscription.CloseAsync().ConfigureAwait(false);
log.Write(LogLevel.Debug, $"{Id} order book {Symbol} stopped");
}
/// <summary>