diff --git a/CryptoExchange.Net.UnitTests/TestImplementations/TestSocket.cs b/CryptoExchange.Net.UnitTests/TestImplementations/TestSocket.cs index 35d2536..cf8c354 100644 --- a/CryptoExchange.Net.UnitTests/TestImplementations/TestSocket.cs +++ b/CryptoExchange.Net.UnitTests/TestImplementations/TestSocket.cs @@ -36,6 +36,8 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations public string Origin { get; set; } public int? RatelimitPerSecond { get; set; } + public double IncomingKbps => throw new NotImplementedException(); + public static int lastId = 0; public static object lastIdLock = new object(); diff --git a/CryptoExchange.Net/CryptoExchange.Net.xml b/CryptoExchange.Net/CryptoExchange.Net.xml index 889f56b..b2593e7 100644 --- a/CryptoExchange.Net/CryptoExchange.Net.xml +++ b/CryptoExchange.Net/CryptoExchange.Net.xml @@ -3389,6 +3389,16 @@ A wrapper around the ClientWebSocket + + + Received messages time -> size + + + + + Received messages lock + + Log @@ -3612,6 +3622,11 @@ + + + Update the received messages list, removing messages received longer than 3s ago + + An update received from a socket update subscription @@ -3999,3 +4014,148 @@ +System.Diagnostics.CodeAnalysis.AllowNullAttribute"> + + Specifies that is allowed as an input even if the + corresponding type disallows it. + + + + + Initializes a new instance of the class. + + + + + Specifies that is disallowed as an input even if the + corresponding type allows it. + + + + + Initializes a new instance of the class. + + + + + Specifies that a method that will never return under any circumstance. + + + + + Initializes a new instance of the class. + + + + + Specifies that the method will not return if the associated + parameter is passed the specified value. + + + + + Gets the condition parameter value. + Code after the method is considered unreachable by diagnostics if the argument + to the associated parameter matches this value. + + + + + Initializes a new instance of the + class with the specified parameter value. + + + The condition parameter value. + Code after the method is considered unreachable by diagnostics if the argument + to the associated parameter matches this value. + + + + + Specifies that an output may be even if the + corresponding type disallows it. + + + + + Initializes a new instance of the class. + + + + + Specifies that when a method returns , + the parameter may be even if the corresponding type disallows it. + + + + + Gets the return value condition. + If the method returns this value, the associated parameter may be . + + + + + Initializes the attribute with the specified return value condition. + + + The return value condition. + If the method returns this value, the associated parameter may be . + + + + + Specifies that an output is not even if the + corresponding type allows it. + + + + + Initializes a new instance of the class. + + + + + Specifies that the output will be non- if the + named parameter is non-. + + + + + Gets the associated parameter name. + The output will be non- if the argument to the + parameter specified is non-. + + + + + Initializes the attribute with the associated parameter name. + + + The associated parameter name. + The output will be non- if the argument to the + parameter specified is non-. + + + + + Specifies that when a method returns , + the parameter will not be even if the corresponding type allows it. + + + + + Gets the return value condition. + If the method returns this value, the associated parameter will not be . + + + + + Initializes the attribute with the specified return value condition. + + + The return value condition. + If the method returns this value, the associated parameter will not be . + + + + diff --git a/CryptoExchange.Net/Objects/CallResult.cs b/CryptoExchange.Net/Objects/CallResult.cs index 2607204..f498d19 100644 --- a/CryptoExchange.Net/Objects/CallResult.cs +++ b/CryptoExchange.Net/Objects/CallResult.cs @@ -244,7 +244,7 @@ namespace CryptoExchange.Net.Objects /// The new type /// The data of the new type /// - public WebCallResult As([AllowNull] K data) + public new WebCallResult As([AllowNull] K data) { return new WebCallResult(ResponseStatusCode, ResponseHeaders, OriginalData, data, Error); } diff --git a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs index da7ecc1..88b90f2 100644 --- a/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs +++ b/CryptoExchange.Net/Sockets/CryptoExchangeWebSocketClient.cs @@ -39,8 +39,15 @@ namespace CryptoExchange.Net.Sockets private bool _startedReceive; private readonly List _outgoingMessages; - protected readonly Dictionary _receivedMessages; private DateTime _lastReceivedMessagesUpdate; + + /// + /// Received messages time -> size + /// + protected readonly Dictionary _receivedMessages; + /// + /// Received messages lock + /// protected readonly object _receivedMessagesLock; /// @@ -664,6 +671,9 @@ namespace CryptoExchange.Net.Sockets return _outgoingMessages.Count; } + /// + /// Update the received messages list, removing messages received longer than 3s ago + /// protected void UpdateReceivedMessages() { var checkTime = DateTime.UtcNow;