1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-16 02:43:00 +00:00
Fix for intermittently failing rate limiting test
Added ConnectionId to RequestDefinition to correctly handle connection and path rate limiting configuration
Added ValidateMessage method to websocket Query object to filter messages even though it is matched to the query based on the  ListenIdentifier
Added KlineTracker and TradeTracker implementation
This commit is contained in:
Jan Korf
2024-10-28 10:36:19 +01:00
committed by GitHub
parent ed007b5272
commit 9e86a08327
17 changed files with 2386 additions and 5 deletions
+12 -1
View File
@@ -177,6 +177,10 @@ namespace CryptoExchange.Net.Sockets
/// <inheritdoc />
public override async Task<CallResult> Handle(SocketConnection connection, DataEvent<object> message)
{
var typedMessage = message.As((TServerResponse)message.Data);
if (!ValidateMessage(typedMessage))
return new CallResult(null);
CurrentResponses++;
if (CurrentResponses == RequiredResponses)
{
@@ -186,7 +190,7 @@ namespace CryptoExchange.Net.Sockets
if (Result?.Success != false)
// If an error result is already set don't override that
Result = HandleMessage(connection, message.As((TServerResponse)message.Data));
Result = HandleMessage(connection, typedMessage);
if (CurrentResponses == RequiredResponses)
{
@@ -198,6 +202,13 @@ namespace CryptoExchange.Net.Sockets
return Result;
}
/// <summary>
/// Validate if a message is actually processable by this query
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public virtual bool ValidateMessage(DataEvent<TServerResponse> message) => true;
/// <summary>
/// Handle the query response
/// </summary>