diff --git a/CryptoExchange.Net.UnitTests/TestImplementations/TestRestClient.cs b/CryptoExchange.Net.UnitTests/TestImplementations/TestRestClient.cs index b05e272..2a6800c 100644 --- a/CryptoExchange.Net.UnitTests/TestImplementations/TestRestClient.cs +++ b/CryptoExchange.Net.UnitTests/TestImplementations/TestRestClient.cs @@ -135,7 +135,7 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations throw new NotImplementedException(); } - protected override TimeSyncInfo GetTimeSyncInfo() + public override TimeSyncInfo GetTimeSyncInfo() { throw new NotImplementedException(); } @@ -161,7 +161,7 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations throw new NotImplementedException(); } - protected override TimeSyncInfo GetTimeSyncInfo() + public override TimeSyncInfo GetTimeSyncInfo() { throw new NotImplementedException(); } diff --git a/CryptoExchange.Net/Clients/BaseSocketClient.cs b/CryptoExchange.Net/Clients/BaseSocketClient.cs index b81c132..a8cd86a 100644 --- a/CryptoExchange.Net/Clients/BaseSocketClient.cs +++ b/CryptoExchange.Net/Clients/BaseSocketClient.cs @@ -92,7 +92,9 @@ namespace CryptoExchange.Net } } + /// public int CurrentConnections => socketConnections.Count; + /// public int CurrentSubscriptions { get diff --git a/CryptoExchange.Net/Interfaces/ISocketClient.cs b/CryptoExchange.Net/Interfaces/ISocketClient.cs index be81455..f441093 100644 --- a/CryptoExchange.Net/Interfaces/ISocketClient.cs +++ b/CryptoExchange.Net/Interfaces/ISocketClient.cs @@ -27,6 +27,16 @@ namespace CryptoExchange.Net.Interfaces /// public double IncomingKbps { get; } + /// + /// The current amount of connections to the API from this client. A connection can have multiple subscriptions. + /// + public int CurrentConnections { get; } + + /// + /// The current amount of subscriptions running from the client + /// + public int CurrentSubscriptions { get; } + /// /// Unsubscribe from a stream using the subscription id received when starting the subscription /// diff --git a/CryptoExchange.Net/Objects/Options.cs b/CryptoExchange.Net/Objects/Options.cs index 01cbfa3..0494e66 100644 --- a/CryptoExchange.Net/Objects/Options.cs +++ b/CryptoExchange.Net/Objects/Options.cs @@ -14,7 +14,7 @@ namespace CryptoExchange.Net.Objects /// public class BaseOptions { - internal event Action OnLoggingChanged; + internal event Action? OnLoggingChanged; private LogLevel _logLevel = LogLevel.Information; /// diff --git a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs index a2c5707..92f5670 100644 --- a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs +++ b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs @@ -31,7 +31,7 @@ namespace CryptoExchange.Net.Sockets private readonly IDictionary cookies; private readonly IDictionary headers; private CancellationTokenSource _ctsSource; - private ApiProxy _proxy; + private ApiProxy? _proxy; private readonly List _outgoingMessages; private DateTime _lastReceivedMessagesUpdate; @@ -342,7 +342,8 @@ namespace CryptoExchange.Net.Sockets while (_sendBuffer.TryDequeue(out _)) { } // Clear send buffer _socket = CreateSocket(); - SetProxy(_proxy); + if (_proxy != null) + SetProxy(_proxy); _closed = false; }